Skip to content

Built-in models not affected by acl generator #1582

Closed

Description

@duckontheweb

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.

Jon

Activity

  1. superkhau commented on Aug 11, 2015

    @superkhau
    Contributor

    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.

  2. self-assigned this
    on Aug 11, 2015
  3. raymondfeng commented on Aug 11, 2015

    @raymondfeng
    Member

    We probably should fix the generator so that acls go into server/model-config.json. This way, it will work with all models.

  4. superkhau commented on Aug 11, 2015

    @superkhau
    Contributor

    @raymondfeng +1 TOB?

  5. crandmck commented on Aug 11, 2015

    @crandmck
    Contributor

    Can we update the docs?

    I added a note to http://docs.strongloop.com/display/LB/ACL+generator

    ... the documentation seemed to suggest that I could do this with the generator instead.

    @jduckworth What doc are you referring to? Please let me know so I can update it.

  6. duckontheweb commented on Aug 11, 2015

    @duckontheweb
    Author

    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:

    Can we update the docs?

    I added a note to http://docs.strongloop.com/display/LB/ACL+generator

    ... the documentation seemed to suggest that I could do this with the
    generator instead.

    @jduckworth https://github.com/jduckworth What doc are you referring
    to? Please let me know so I can update it.

    —
    Reply to this email directly or view it on GitHub
    #1582 (comment)
    .

  7. crandmck commented on Aug 11, 2015

    @crandmck
    Contributor

    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.

  8. duckontheweb commented on Aug 12, 2015

    @duckontheweb
    Author

    Great, you guys rock!

  9. crandmck commented on Aug 12, 2015

    @crandmck
    Contributor

    Aw, thanks! :-)

  10. superkhau commented on Aug 12, 2015

    @superkhau
    Contributor

    @crandmck leaving this issue open as raymond suggested we add the feature above

  11. faridnsh commented on Aug 19, 2015

    @faridnsh
    Contributor

    @crandmck Actually it seems like we can't override user acl from model-config.json or models.json

  12. ritch commented on Aug 19, 2015

    @ritch
    Member

    @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 = [];
    
  13. crandmck commented on Aug 19, 2015

    @crandmck
    Contributor

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

  14. removed their assignment
    on Feb 3, 2016
  15. stale commented on Sep 6, 2017

    @stale

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions