Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.1
    • Component/s: Components Core
    • Labels:
      None

      Description

      When I make an association between two groups, the methods getGroupsAssociatedTo and getGroupsAssociatedFrom returns the same result. for example:

      this.groupManager.addGroupToGroup(AA, BB, JetspeedPrincipalAssociationType.IS_PART_OF);

      This returns two records:
      List <Group> lista = this.groupManager.getGroupsAssociatedTo(AA, JetspeedPrincipalAssociationType.IS_PART_OF );
      List <Group> lista = this.groupManager.getGroupsAssociatedFrom(AA, JetspeedPrincipalAssociationType.IS_PART_OF );

      This returno no records:
      List <Group> lista = this.groupManager.getGroupsAssociatedTo(BB, JetspeedPrincipalAssociationType.IS_PART_OF );
      List <Group> lista = this.groupManager.getGroupsAssociatedFrom(BB, JetspeedPrincipalAssociationType.IS_PART_OF );

      I think the problem is in class [GroupManagerImpl], who extends [BaseJetspeedPrincipalManager]. GroupManagerImpl has "getGroupsAssociatedFrom" and "getGroupsAssociatedTo" methods, but both call the same method of [BaseJetspeedPrincipalManager]:

      /* (non-Javadoc)

      • @see org.apache.jetspeed.security.GroupManager#getGroupsAssociatedFrom(org.apache.jetspeed.security.Group, java.lang.String)
        */
        @SuppressWarnings("unchecked")
        public List<Group> getGroupsAssociatedFrom(Group from, String associationName) { return (List<Group>)getAssociatedFrom(from.getName(), from.getType(), associationName); }

      /* (non-Javadoc)

      • @see org.apache.jetspeed.security.GroupManager#getGroupsAssociatedTo(org.apache.jetspeed.security.Group, java.lang.String)
        */
        @SuppressWarnings("unchecked")
        public List<Group> getGroupsAssociatedTo(Group to, String associationName) { return (List<Group>)getAssociatedFrom(to.getName(), to.getType(), associationName); }

      when "getGroupsAssociatedTo" method must call "BaseJetspeedPrincipalManager.getAssociatedTo", nor "BaseJetspeedPrincipalManager.getAssociatedFrom".

      Regards
      Francisco Rosado

        Activity

        Hide
        Ate Douma added a comment -

        Fix committed.

        Show
        Ate Douma added a comment - Fix committed.
        Hide
        Ate Douma added a comment - - edited

        Hi Francisco,

        I just looked at the getGroupsAssociatedTo method in GroupManagerImpl and it indeed is implemented wrong.
        Your comments are spot on and the suggested fix is appropriate.
        I will commit this shortly, as well as fixing the exact same bug in RoleManagerImpl.
        Thanks for catching this and reporting the issue!

        Show
        Ate Douma added a comment - - edited Hi Francisco, I just looked at the getGroupsAssociatedTo method in GroupManagerImpl and it indeed is implemented wrong. Your comments are spot on and the suggested fix is appropriate. I will commit this shortly, as well as fixing the exact same bug in RoleManagerImpl. Thanks for catching this and reporting the issue!
        Hide
        Francisco Javier Rosado added a comment -

        Well,

        I have recompiled the jetspeed-security-2.2.0.jar with the mentionated changes and works fine for me.

        I have changed in GroupManagerImpl:

        public List<Group> getGroupsAssociatedTo(Group to, String associationName)

        { return (List<Group>)getAssociatedTo(to.getName(), to.getType(), associationName); }

        Regards,
        Francisco Rosado

        Show
        Francisco Javier Rosado added a comment - Well, I have recompiled the jetspeed-security-2.2.0.jar with the mentionated changes and works fine for me. I have changed in GroupManagerImpl: public List<Group> getGroupsAssociatedTo(Group to, String associationName) { return (List<Group>)getAssociatedTo(to.getName(), to.getType(), associationName); } Regards, Francisco Rosado
        Hide
        Woonsan Ko added a comment -

        I have looked around those with j2-admin UIs. I think the UIs to configure user/role/group associations working intendedly although it is not fully intuitive to be honest.

        I think Francisco raised this issue with respect to the API usages and those semantics.
        I agree that it looks strange to have getGroupsAssociatedTo(to, assoc) invoking getAssociatedFrom(to, assoc) semantically.

        So, I think this issue is kind of API semantics issue.
        I think Ate is the best person to review these later.

        Kind regards,

        Woonsan

        Show
        Woonsan Ko added a comment - I have looked around those with j2-admin UIs. I think the UIs to configure user/role/group associations working intendedly although it is not fully intuitive to be honest. I think Francisco raised this issue with respect to the API usages and those semantics. I agree that it looks strange to have getGroupsAssociatedTo(to, assoc) invoking getAssociatedFrom(to, assoc) semantically. So, I think this issue is kind of API semantics issue. I think Ate is the best person to review these later. Kind regards, Woonsan

          People

          • Assignee:
            Ate Douma
            Reporter:
            Francisco Javier Rosado
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development