We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: OpenGeek at May 22, 2009, 11:14 PM

    High-level, you’ll need to create a new Resource policy without the attributes representing the permissions you want to restrict on a resource.  Try taking away the view attribute from the policy you have attached as an access control list between the Resource Group you want to restrict access to and the User Group of the user you are testing with (in the mgr context for controlling view permission in the manager).  You should not be able to view the object then in the mgr (and the same in the web context if you assigned that access control list to web).  If you want it to disappear from the tree, remove the list attribute.

    Ow!  That hurt my brain.  wink

    But seriously, I’ve been playing with this and can’t seem to be able to create a manager user who can log in to the Manager. I’ve created a role, resource group, policy, etc. and given the user access to the manager context.

    When I look at the user grid, my user has a role of "none" but when I click on the Access Permissions tab, the user has the role I assigned to him. I did flush the permissions.

    When I try to log in to the manager as that user, I get Error Permission denied [logout].  When I click on logout, I get this: {"success":true,"message":"","total":0,"data":[],"object":[]}. If I then hit the back button, I get the login screen.

      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: BobRay at May 23, 2009, 12:05 AM

      Ow! That hurt my brain. wink
      You should try writing the code... tongue
      Quote from: BobRay at May 23, 2009, 12:05 AM

      But seriously, I’ve been playing with this and can’t seem to be able to create a manager user who can log in to the Manager. I’ve created a role, resource group, policy, etc. and given the user access to the manager context.

      When I look at the user grid, my user has a role of "none" but when I click on the Access Permissions tab, the user has the role I assigned to him. I did flush the permissions.
      Access to management actions (including logging in to the mgr context, or even the ability to load the mgr context object itself) are driven by Context policies; these policies define a wide variety of permissions a User Group has in a particular Context, including the low-level permissions for loading, saving, listing, viewing, etc. the Context object iself, as well as the various actions a user can initiate from that Context (e.g. remove_locks, delete_snippet, publish_document, etc.) which are similar to the legacy permissions that were provided by the User Role in 0.9.x.

      After a clean installation, by default you will have a single access control list (ACL) assigning the full Context policy on the mgr context to users of the Administrators group with an Authority of 0. This Authority level means that even if the user is a member of the group, they must have a membership Role with an Authority level less than or equal to 0. Since nothing is less than 0, the only users who will have access are users in the Administrators group with a membership Role of Super User (or another Role you define that has an Authority of 0.

      The user grid needs to be corrected; the User Role information it is showing is invalid since User Roles are no longer applicable. When we speak of Roles in Revolution, we are referring to the Role a user has within a specific User Group. Outside of that group membership, these Roles are meaningless.

      Quote from: BobRay at May 23, 2009, 12:05 AM

      When I try to log in to the manager as that user, I get Error Permission denied [logout]. When I click on logout, I get this: {"success":true,"message":"","total":0,"data":[],"object":[]}. If I then hit the back button, I get the login screen.
      Right, see above; I’ll bet your user is not a Super User in the Administrators group. You can change his Role to Super User, or add a new ACL exactly like the existing one except with an Authority of 9999 (the highest possible value, but consequently, lowest level of authority a user can have). 9999 is the Authority which is given to a user in a group with the default Member role.

      As for the JSON response on logout, that is an unresolved loose end actually. That’s a JSON response indicating the logout was successful, but it is not being request via Ajax, so it looks kind of wierd and obviously is not being handled properly. We’ll get that fixed up.
        • 3749
        • 24,544 Posts
        It sounds like you’re saying that no one can log into the manager unless they have an authority level of 0.

        That seems counterintuitive since it would mean that all users would have the same authority level in the manager.

        Can you explain what authority level actually means and how it would be used?
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: BobRay at May 23, 2009, 02:39 PM

          It sounds like you’re saying that no one can log into the manager unless they have an authority level of 0.

          That seems counterintuitive since it would mean that all users would have the same authority level in the manager.
          This is simply the default configuration.  All you need to do to enable other users to login to the manager is design a new Context Policy with the permissions they should have (i.e. if they should NOT be able to manage access permissions, remove the policy attributes related to that), and create a new ACL with the Authority of 9999 to the Administrators group (or another group, maybe Editors, if you so chose) so regular "Members" of the Administators group can also login, but not necessarily share a full set of permissions (aka Policy attributes).

          Quote from: BobRay at May 23, 2009, 02:39 PM

          Can you explain what authority level actually means and how it would be used?
          I’m trying...  wink

          Authority allows you to design access control lists with different Policies based on what Role a User plays in a User Group.  Since a Role of Super User in the Administrators group has an Authority of 0, this means they will have access to ANY and ALL policies assigned to that group because you cannot set the Authority level to less than 0.  From there, you can design an entire Security system with various Roles in each Group, so you, as an example, can provide special Policies for Group Administrators (or Super Users) vs. regular Members.  Having an Authority range from 0 (most authority) to 9999 (least authority) means you have up to 10000 levels of granularity in the User Group/Role relation (i.e. you could assign 10000 different Policies to a single User Group, having Authority levels ranging from 0 to 9999 via the Role a User can be assigned in each Group).
            • 25663 MODX Staff
            • 12,272 Posts
            I think the period key on Jason’s keyboard is a bit faulty. tongue Jason is the following accurate?

            To enable other users to login to the manager you first have to design a new Context Policy with the correct permissions, which are technically called Policy Attributes. For example, to keep a user from being able to manage access permissions, first remove those Policy Attributes and then create a new Access Control List ("ACL") with an Authority of 9999 in an "Administrators" or "Editors" group. This way regular members of this new group can login, but with restricted access to some manager functionality.

            Authority Levels let you create ACLs with different Policies based on what Role a User plays in a User Group. Since a Role of Super User in the Administrators group has an Authority of 0, this means they can access all Policies assigned to that User Group. An Authority of 0 is the highest and 9999 is the lowest and most restricted. For example, you can create special Policies for "Administrators" vs. regular site "Members" by giving the Administrators a higher (smaller number) Authority than the site Members.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 3749
              • 24,544 Posts
              Still wrestling with this. It sounds like the point is to allow users within the same user group to have different capabilities. I’m assuming (perhaps incorrectly) that users have all the rights of users with higher authority numbers and but none of the rights of users with lower numbers.

              So users don’t have roles, user groups do, and the authority number determines which of the role’s capabilities the user can access? Am I getting close?

              I still wonder if it wouldn’t make sense to allow all users with access to the manager context to log in to the manager. It seems counterintuitive to be able to create a manager user who can’t log in to the manager. My manager user has an authority of 5 (picked out of the air) but can’t log in.

              I can see the value of having the hierarchy of authority numbers, but I’m wondering if it’s worth the pain of having to remember exactly what each authority number means in terms of what the user can and can’t do. At first glance, I’d rather just create a different role for each pattern of capabilities rather than messing with authority numbers-- I can’t imagine a scenario where I’d need that many different roles (assuming that any of what I’ve written here makes any sense at all). wink
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 25663 MODX Staff
                • 12,272 Posts
                Jason, can you provide a couple of bits of information to clarify a few things?

                [*] Background information (links) on the inspiration for the new security model: Attribute Based Access Control (ABAC)
                [*] A few example screenshots of creating different permissions that would have been common in 096x/Evolution (maybe a restricted Editor role as above, and a couple of different front end user groups like an application normal user and an application admin user.

                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: BobRay at May 23, 2009, 11:24 PM

                  Still wrestling with this. It sounds like the point is to allow users within the same user group to have different capabilities. I’m assuming (perhaps incorrectly) that users have all the rights of users with higher authority numbers and but none of the rights of users with lower numbers.
                  For now, permissions are assigned by User Group and a Role defines the user’s Membership-level in that User Group. Think of a Super User member of the Administrators group as having the greatest Authority within the Administrators, and thus will have all of the Policies assigned to that User Group for ACLs with an Authority >= the Authority assigned to them by their Role in the group.

                  Quote from: BobRay at May 23, 2009, 11:24 PM

                  So users don’t have roles, user groups do, and the authority number determines which of the role’s capabilities the user can access? Am I getting close?
                  Roles define a User’s membership within a User Group. So Roles are now more concisely, User Group Membership Roles, as opposed to just User Roles, like we had in the legacy system.

                  Quote from: BobRay at May 23, 2009, 11:24 PM

                  I still wonder if it wouldn’t make sense to allow all users with access to the manager context to log in to the manager. It seems counterintuitive to be able to create a manager user who can’t log in to the manager. My manager user has an authority of 5 (picked out of the air) but can’t log in.
                  As soon as someone wants Adminstrators that can only use a front-end editing tool like QuickEdit, that model breaks down.

                  All you have to do is change the Authority level on the ACL that is installed for the Administrators group with the default Context Policy to 9999 then, and any member of the Administrators group will then also have that full-access policy. Remember, there are no longer any data entities known as "manager users" in MODx Revolution, just users, and likewise, no difference between Manager User Groups and Web User Groups; they are just User Groups now. Policies are assigned between a User Group and a target object, for now either a Context or a specific Resource (in the future they will also be assignable to Elements and any other data object you could possibly imagine).

                  Technically, you don’t need anything other than the Administrators group and several Roles to re-create a security model akin to 0.9.6.x’s manager system (i.e. an Editor’s role in the Administrators User Group vs. a Manager User Group called Editors). It just depends on what you want. The idea is we will have several "typical" security model packages in the repository that will provide a template for some common security models; users can install them to jump-start the process of designing their security model, and most will probably be able to use the one they chose out of the box. But others will want to design custom models to specification, from scratch.

                  If someone could define a common security model or two they think would make a great example or starting point for most situations, I would be glad to configure it and show some screenshots of how I did so and/or build a package from it you could install directly in your Revo installation.

                  Quote from: BobRay at May 23, 2009, 11:24 PM

                  I can see the value of having the hierarchy of authority numbers, but I’m wondering if it’s worth the pain of having to remember exactly what each authority number means in terms of what the user can and can’t do. At first glance, I’d rather just create a different role for each pattern of capabilities rather than messing with authority numbers-- I can’t imagine a scenario where I’d need that many different roles (assuming that any of what I’ve written here makes any sense at all). wink
                  That’s why they are assigned via Roles, so you don’t have to remember what the Authority number means; you can codify it by creating Roles that represent your model logically instead of just numerically.
                    • 3749
                    • 24,544 Posts
                    Quote from: OpenGeek at May 24, 2009, 11:27 AM

                    If someone could define a common security model or two they think would make a great example or starting point for most situations, I would be glad to configure it and show some screenshots of how I did so and/or build a package from it you could install directly in your Revo installation.

                    I think what would help me the most is to see a list of all the specific steps (with no steps combined) necessary to create users with specific rights.

                    For example, say:

                    Joe Blow can log in to the manager, can see and edit some resources, can see and not edit others, and can’t see or edit a third group.
                    Jane Doe can upload and manage pictures via MaxiGallery but can’t do anything else.
                    John Doe can edit a subset of resources via QuickEdit in the front end, but can’t log in to the manager.


                    That’s why they are assigned via Roles, so you don’t have to remember what the Authority number means; you can codify it by creating Roles that represent your model logically instead of just numerically.
                    Is there a one-to-one correspondence between Roles and Authority numbers?
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 29606
                      • 63 Posts
                      Still trying to get it to work, and I still don’t get it...

                      I think I found several bugs on the way, though, so I thought I might share them :


                      • When setting "Ressource Group Access" under "manage user groups and roles" -> "update a user group", if you do not fill in Access Policy and Context, the form validates ok, but then you can’t update this user group anymore : when you try to update the user group, the form is blank, as if creating a new group.
                      • Under "Access Permissions" , in "User Group Access to Ressource Groups" if you create a rule with user group set to "anonymous", the rule doesn’t appear in the list
                      • It seems you can’t edit any rule in "User Group Access to Ressource Groups" : the window opening only has a Save and a Cancel button, and no fields

                      Plus I really don’t understand the way permissions work :
                      I put Document A in Group B
                      When no user group is assigned to Group B -> Document A is visible in both contexts
                      When Group B linked to user Group C, with autority 0, Access Policy "Ressource" and Context : "Web" -> Document A is visible in manager, not in Web context (either when not logged or logged with a member of Group C)
                      If you leave the Context field empty, the document is no longer visible in manager as well.

                      The way I understand how permissions should work, it should be visible when you are logged with a member of group C ?

                      But I think I might have an idea as to where the problem might be :
                      I am also trying to use the MemberCheck snippet, and there are problems here as well :

                      • First, if you don’t remplace "$this->" by "$modx->" in the following line of the snippet, you get an error.
                      /* check if inside manager */
                      if (!is_object($this->context) || ($this->context->get('key') === 'mgr')) {
                          return ''; /* don't go any further when inside manager */
                      }


                      • Secondly and most important, I think, MemberCheck never returns anything (it does not detects if you are member of any group). I traced the problem until function isMemberOfWebGroup (in modx.class.php, line 1331) :
                      if ($groupMemberships= $user->getMany('modWebGroupMember'))
                      returns no value. I’m wondering if maybe it might be a similar cause as to why Documents permissions don’t work the way I expect them to ? (Or maybe I really don’t understand anything, despite the kind explanations of OpenGeek ?)

                      By the way, I’m now using revision 5070, in case it helps...