Closed yornaath closed 7 years ago
Thank you! I will submit a commit later today with your corrections 🙏😌
On Wed, 12 Apr 2017 at 17:18, Aaron Bruce notifications@github.com wrote:
@spruce-bruce commented on this pull request.
Hi there! I don't know much about typescript, but I have a couple notes.
In typings.d.ts https://github.com/djvirgen/virgen-acl/pull/15#discussion_r111179755:
- export interface IResourceProp {
- resource_id:string;
- }
- export interface IResourceGetter {
- getResourceId():string;
- }
- export type IResource = IResourceGetter | IResourceProp | string
- export interface IRoleProp {
- role_id:string;
- }
- export interface IRoleGetter {
- getRoleId():string;
I don't know anything about type declarations, but this can also return an array.
In typings.d.ts https://github.com/djvirgen/virgen-acl/pull/15#discussion_r111179864:
- (err:Error, role:Ro, resource:Re, action:string, result:IAssertionResult, next:Function)
- }
- export interface IAssertionResult {
- (error?:Error, result?:boolean): void
- }
- export class Acl {
- addRole(role:string, parent?:string):void
- addResource(resource:string, parent?:string):void
- allow<Ro extends IRole, Re extends IResource> (role?:string, resource?:string, actions?:string[], assertion?:boolean|IAssertion<Ro, Re>):void
- deny<Ro extends IRole, Re extends IResource> (role?:string, resource?:string, actions?:string[], assertion?:boolean|IAssertion<Ro, Re>):void
role here can also be an array
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/djvirgen/virgen-acl/pull/15#pullrequestreview-32406678, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZIa-ti9ejLbvVYLKiDQDttTQa_3Shiks5rvOtIgaJpZM4M7Y5w .
This looks good, thank you so much for doing this! I'm familiar with TypeScript but haven't used it much myself. I'm looking forward to seeing how this can help with your fellow TypeScript coders!
I'll merge this and publish a new version now. If you run into any issues please file a bug report here. Thank you!
virgen-acl@0.0.22 has been published to npm. Thanks again!
I added some ambient types for Typescript. All tests passed. No interference with source code itself.
Love this module! 🍻 ❤️ 😄