You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Built-in models not affected by acl generator #1582
Using scl loopback:acl on built-in model Role has no effect on remote restrictions. I am trying to make Roles accessible only to a superuser admin and started by making it public and then attempted to restrict access to all using:
$ slc loopback:acl
? Select the model to apply the ACL entry to: Role
? Select the ACL scope: All methods and properties
? Select the access type: All (match all types)
? Select the role: All users
? Select the permission to apply: Explicitly deny access
However, I still have unauthenticated acces to the model's REST API for all methods.
Modifying server/model-config.json does the trick, but the documentation seemed to suggest that I could do this with the generator instead.
I'm new to this, so it's possible I've just missed something small. I appreciate the help.
Thanks for the quick response. The doc I was referring to is here: http://docs.strongloop.com/display/public/LB/Managing+users. It describes
how to edit the ACL within server/model-config.json, but then at the bottom
it also suggests that you can use the slc tool to do the same thing as
well. Now that I read it again, I guess it does say "other models," so I
guess that makes sense, but maybe it's worth being explicit about the fact
that the slc won't alter built-in models.
Very appreciative of everything you all do to maintain this!
Thanks @jduckworth... that sentence about using the tool to modify other models seemed superfluous, so I just deleted it and added a note that you can't use the ACL generator.
@crandmck Actually it seems like we can't override user acl from model-config.json or models.json
This is right. You should be able to do this. Below is a simple work around you can do from a boot script.
var defaultACL = server.models.User.settings.acls;
console.log(defaultACL); // output the defaults
// create an entirely new list (or modify a copy of the defaultACL)
server.models.User.settings.acls = [];
@alFReD-NSH I edited the docs to remove the part about using model-config.json.
I'm not sure what you're referring to with models.json. If you mean the "model JSON file", e.g. common/models/myModel.json, you should be able to use that to define an ACL for a model that extends the built-in user model. However, note that the ACL of your model is added to the default user model ACL, using "precedence rules". See https://docs.strongloop.com/display/LB/Controlling+data+access#Controllingdataaccess-ACLruleprecedence for details.
As an example, see loopback-faq-user-management; specifically user.json. Note that this example model is called user (lowercase) that extends the built-in User (capitalized) model.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.
Activity
superkhau commentedon Aug 11, 2015
You cannot modify built-in models using the ACL generator.
@crandmck Can we update the docs? @jduckworth seems to think the docs suggest you can do this.
raymondfeng commentedon Aug 11, 2015
We probably should fix the generator so that acls go into server/model-config.json. This way, it will work with all models.
superkhau commentedon Aug 11, 2015
@raymondfeng +1 TOB?
crandmck commentedon Aug 11, 2015
I added a note to http://docs.strongloop.com/display/LB/ACL+generator
@jduckworth What doc are you referring to? Please let me know so I can update it.
duckontheweb commentedon Aug 11, 2015
Hi Rand-
Thanks for the quick response. The doc I was referring to is here:
http://docs.strongloop.com/display/public/LB/Managing+users. It describes
how to edit the ACL within server/model-config.json, but then at the bottom
it also suggests that you can use the slc tool to do the same thing as
well. Now that I read it again, I guess it does say "other models," so I
guess that makes sense, but maybe it's worth being explicit about the fact
that the slc won't alter built-in models.
Very appreciative of everything you all do to maintain this!
Jon
On Tue, Aug 11, 2015 at 3:24 PM, Rand McKinney notifications@github.com
wrote:
crandmck commentedon Aug 11, 2015
Thanks @jduckworth... that sentence about using the tool to modify other models seemed superfluous, so I just deleted it and added a note that you can't use the ACL generator.
duckontheweb commentedon Aug 12, 2015
Great, you guys rock!
crandmck commentedon Aug 12, 2015
Aw, thanks! :-)
superkhau commentedon Aug 12, 2015
@crandmck leaving this issue open as raymond suggested we add the feature above
faridnsh commentedon Aug 19, 2015
@crandmck Actually it seems like we can't override user acl from model-config.json or models.json
ritch commentedon Aug 19, 2015
This is right. You should be able to do this. Below is a simple work around you can do from a boot script.
crandmck commentedon Aug 19, 2015
@alFReD-NSH I edited the docs to remove the part about using
model-config.json.I'm not sure what you're referring to with
models.json. If you mean the "model JSON file", e.g.common/models/myModel.json, you should be able to use that to define an ACL for a model that extends the built-in user model. However, note that the ACL of your model is added to the default user model ACL, using "precedence rules". See https://docs.strongloop.com/display/LB/Controlling+data+access#Controllingdataaccess-ACLruleprecedence for details.As an example, see loopback-faq-user-management; specifically user.json. Note that this example model is called
user(lowercase) that extends the built-inUser(capitalized) model.stale commentedon Sep 6, 2017
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the
CODEOWNERSfile at the top-level of this repository.