fixed middleware types for @types/acl

version update
This commit is contained in:
javiercbk
2016-11-27 23:09:08 -03:00
parent 9b9f0f4658
commit eb6688ffef
2 changed files with 21 additions and 2 deletions

View File

@@ -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
View File

@@ -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 {