mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
fixed middleware types for @types/acl
version update
This commit is contained in:
@@ -12,6 +12,23 @@ var report = <T>(err: Error, value: T) => {
|
||||
// Using the memory backend
|
||||
var acl = new Acl(new Acl.memoryBackend());
|
||||
|
||||
// middleware with no optional parameters
|
||||
acl.middleware();
|
||||
|
||||
acl.middleware(1);
|
||||
|
||||
acl.middleware(1, () => {
|
||||
return "joed";
|
||||
});
|
||||
|
||||
acl.middleware(1, () => {
|
||||
return 2;
|
||||
});
|
||||
|
||||
acl.middleware(1, 'joed');
|
||||
|
||||
acl.middleware(3, 'joed', 'post');
|
||||
|
||||
// guest is allowed to view blogs
|
||||
acl.allow('guest', 'blogs', 'view');
|
||||
|
||||
|
||||
6
acl/index.d.ts
vendored
6
acl/index.d.ts
vendored
@@ -1,13 +1,15 @@
|
||||
// Type definitions for node_acl 0.4.7
|
||||
// Type definitions for node_acl 0.4.8
|
||||
// Project: https://github.com/optimalbits/node_acl
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="bluebird" />
|
||||
/// <reference types="node"/>
|
||||
/// <reference types="express"/>
|
||||
|
||||
import http = require('http');
|
||||
import Promise = require("bluebird");
|
||||
import express = require("express");
|
||||
|
||||
type strings = string|string[];
|
||||
type Value = string|number;
|
||||
@@ -49,7 +51,7 @@ interface Acl {
|
||||
areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise<any>;
|
||||
whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise<any>;
|
||||
permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise<void>;
|
||||
middleware: (numPathComponents: number, userId: Value | GetUserId, actions: strings) => Promise<any>;
|
||||
middleware: (numPathComponents?: number, userId?: Value | GetUserId, actions?: strings) => express.RequestHandler;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
|
||||
Reference in New Issue
Block a user