mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Rename things
This commit is contained in:
@@ -14,3 +14,4 @@ acl.allow('guest', 'blogs', 'view');
|
||||
|
||||
// allow function accepts arrays as any parameter
|
||||
acl.allow('member', 'blogs', ['edit','view', 'delete']);
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ declare module "acl" {
|
||||
mongodbBackend: MongodbBackendStatic;
|
||||
}
|
||||
|
||||
interface MongodbBackend extends Backend<ErrCallback> { }
|
||||
interface MongodbBackend extends Backend<Callback> { }
|
||||
interface MongodbBackendStatic {
|
||||
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
|
||||
new(db: mongo.Db, prefix: string): MongodbBackend;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='./acl-redisBackend.d.ts'/>
|
||||
/// <reference path='acl-redisBackend.d.ts'/>
|
||||
|
||||
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
|
||||
import Acl = require('acl');
|
||||
|
||||
Vendored
+25
-22
@@ -10,14 +10,14 @@ declare module "acl" {
|
||||
import http = require('http');
|
||||
import Promise = require("bluebird");
|
||||
|
||||
type Func = ()=>any;
|
||||
type strings = string|string[];
|
||||
type Value = string|number;
|
||||
type Values = Value|Value[];
|
||||
type strings = string|string[];
|
||||
type ErrCallback = (err: Error) => any;
|
||||
type Action = () => any;
|
||||
type Callback = (err: Error) => any;
|
||||
type AnyCallback = (err: Error, obj: any) => any;
|
||||
type AllowedCallback = (err: Error, allowed: boolean) => any;
|
||||
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => any;
|
||||
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value;
|
||||
|
||||
interface AclStatic {
|
||||
new (backend: Backend<any>, logger: Logger, options: Option): Acl;
|
||||
@@ -31,19 +31,19 @@ declare module "acl" {
|
||||
}
|
||||
|
||||
interface Acl {
|
||||
addUserRoles: (userId: Value, roles: strings, cb?: ErrCallback) => Promise<void>;
|
||||
removeUserRoles: (userId: Value, roles: strings, cb?: ErrCallback) => Promise<void>;
|
||||
addUserRoles: (userId: Value, roles: strings, cb?: Callback) => Promise<void>;
|
||||
removeUserRoles: (userId: Value, roles: strings, cb?: Callback) => Promise<void>;
|
||||
userRoles: (userId: Value, cb?: (err: Error, roles: string[])=>any) => Promise<string[]>;
|
||||
roleUsers: (role: Value, cb?: (err: Error, users: Values)=>any) => Promise<any>;
|
||||
hasRole: (userId: Value, role: string, cb?: (err: Error, isInRole: boolean)=>any) => Promise<boolean>;
|
||||
addRoleParents: (role: string, parents: Values, cb?: ErrCallback) => Promise<void>;
|
||||
removeRole: (role: string, cb?: ErrCallback) => Promise<void>;
|
||||
removeResource: (resource: string, cb?: ErrCallback) => Promise<void>;
|
||||
addRoleParents: (role: string, parents: Values, cb?: Callback) => Promise<void>;
|
||||
removeRole: (role: string, cb?: Callback) => Promise<void>;
|
||||
removeResource: (resource: string, cb?: Callback) => Promise<void>;
|
||||
allow: {
|
||||
(roles: Values, resources: strings, permissions: strings, cb?: ErrCallback): Promise<void>;
|
||||
(roles: Values, resources: strings, permissions: strings, cb?: Callback): Promise<void>;
|
||||
(aclSets: AclSet|AclSet[]): Promise<void>;
|
||||
}
|
||||
removeAllow: (role: string, resources: strings, permissions: strings, cb?: ErrCallback) => Promise<void>;
|
||||
removeAllow: (role: string, resources: strings, permissions: strings, cb?: Callback) => Promise<void>;
|
||||
removePermissions: (role: string, resources: strings, permissions: strings, cb?: Function) => Promise<void>;
|
||||
allowedPermissions: (userId: Value, resources: strings, cb?: AnyCallback) => Promise<void>;
|
||||
isAllowed: (userId: Value, resources: strings, permissions: strings, cb?: AllowedCallback) => Promise<boolean>;
|
||||
@@ -76,15 +76,23 @@ declare module "acl" {
|
||||
permissions: strings;
|
||||
}
|
||||
|
||||
interface MemoryBackend extends Backend<Action[]> { }
|
||||
interface MemoryBackendStatic {
|
||||
new(): MemoryBackend;
|
||||
}
|
||||
|
||||
//
|
||||
// For internal use
|
||||
//
|
||||
interface Backend<T> {
|
||||
begin: () => T;
|
||||
end: (transaction: T, cb?: Func) => void;
|
||||
clean: (cb?: Func) => void;
|
||||
get: (bucket: string, key: Value, cb?: Func) => void;
|
||||
union: (bucket: string, keys: Value[], cb?: Func) => void;
|
||||
add: (transaction: T, bucket: string, key: Value, values: Value|Value[]) => void;
|
||||
end: (transaction: T, cb?: Action) => void;
|
||||
clean: (cb?: Action) => void;
|
||||
get: (bucket: string, key: Value, cb?: Action) => void;
|
||||
union: (bucket: string, keys: Value[], cb?: Action) => void;
|
||||
add: (transaction: T, bucket: string, key: Value, values: Values) => void;
|
||||
del: (transaction: T, bucket: string, keys: Value[]) => void;
|
||||
remove: (transaction: T, bucket: string, key: Value, values: Value|Value[]) => void;
|
||||
remove: (transaction: T, bucket: string, key: Value, values: Values) => void;
|
||||
|
||||
endAsync: Function; //TODO: Give more specific function signature
|
||||
getAsync: Function;
|
||||
@@ -92,11 +100,6 @@ declare module "acl" {
|
||||
unionAsync: Function;
|
||||
}
|
||||
|
||||
interface MemoryBackend extends Backend<Func[]> { }
|
||||
interface MemoryBackendStatic {
|
||||
new(): MemoryBackend;
|
||||
}
|
||||
|
||||
interface Contract {
|
||||
(args: IArguments): Contract|NoOp;
|
||||
debug: boolean;
|
||||
|
||||
Reference in New Issue
Block a user