flash-oss / node_acl

Access control lists for node applications
MIT License
63 stars 9 forks source link

Support for the Wildcards in Resource names if it is a url for express #11

Open zain-ul-abidin1 opened 2 years ago

zain-ul-abidin1 commented 2 years ago

Problem Statement

Hello, i am using this package and so far its going great, but a small thing is annoying me which is if i am using express url's as resource names in the acl allow rules then the wild cards are not supported e.g.

/api/users/login (resource 1) /api/users/signup (resource 2) /api/users/lremove (resource 3)

e.g. in config they would be written as

{
    "roles": [ "User" ],
    "allows": [
      { "resources": "/api/users/login", "permissions": [ "post", "put", "get", "delete" ] },
      { "resources": "/api/users/signup", "permissions": [ "post", "put", "get", "delete" ] },
      { "resources": "/api/users/remove", "permissions": [ "post", "put", "get", "delete" ] }
    ]
  }

Problem Solution Expected

now to allow these to user we have to define these separately instead of this i am expecting some thing like following in the config

{
    "roles": [ "User" ],
    "allows": [
      { "resources": "/api/users/*", "permissions": [ "post", "put", "get", "delete" ] }
    ]
  }
koresar commented 2 years ago

That's something we would be happy to see! Feel free to implement.

zain-ul-abidin1 commented 2 years ago

Glad to hear from you, i shell definitely