node_acl icon indicating copy to clipboard operation
node_acl copied to clipboard

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

Open zain-ul-abidin1 opened this issue 2 years ago • 2 comments

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" ] }
    ]
  }

zain-ul-abidin1 avatar May 18 '22 07:05 zain-ul-abidin1

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

koresar avatar May 18 '22 08:05 koresar

Glad to hear from you, i shell definitely

zain-ul-abidin1 avatar May 19 '22 07:05 zain-ul-abidin1