Secure jobs/prints by Group attribute for users with Multiple Groups

Sort:
You are not authorized to post a reply.
Author
Messages
mikefortuna
Basic Member
Posts: 14
Basic Member
    I can use this function to find a user's group attribute and then limit them to seeing jobs/prints of users within their own group.  This works, but not if the user has multiple groups assigned to them.

    UserName==user.getHostServiceId()||isMemberOf(user.getAttribute('Group'),UserName)
    'All_ACCESS,'
    else
    'NO_ACCESS"


    How can I do this so that it checks all of the groups assigned to the group attribute?
    Georgette
    Veteran Member
    Posts: 52
    Veteran Member
      I remember from class that the getAttribute function only returns one value. For multiple values the attributeContains function is required.

      I find it interesting that you have combined the isMemberOf() and getAttribute functions.
      mikefortuna
      Basic Member
      Posts: 14
      Basic Member
        The idea was to make one expression that would cover all groups.

        If a user was in the AP group, then the expression would look at their group attribute and allow access to the username element for all users who are also in the AP group.

        This could be done by using isMemberOf('AP',UserName)

        The user.getAttribute('Group') in place of 'AP' would make this dynamic rather than having 'AP' hard coded into the expression. And this works if you only have one group assigned to the user.


        From the Help documentation:
        attributeContains(String IAttrName, String IAttrValue)
        Checks whether, for the current user, the specified attribute contains the specified value.


        attributeContains('Group', 'AP') would return True for my user. But unless I'm missing something from this, I'd need to be able to pull multiple values from the Group attribute.
        Karen Beyer Goode
        Basic Member
        Posts: 4
        Basic Member
          This works for me

          if(UserName==user.getUserName()||isMemberOf('NameOfTheGroup',UserName))
             'I,'
          else
             'NO_ACCESS,'
          Roger French
          Veteran Member
          Posts: 545
          Veteran Member
            What version of environment are you on that that rule works OK?

            I know that with env 9.0.1.11 on Windows (without patches) that rule does NOT work. 
            You are not authorized to post a reply.