Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0
    • Fix Version/s: 5.1.0, 5.1.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 7.10
      Sun Java 6
      Tomcat 6
    • Similar Issues:
      Show 5 results 

      Description

      When a community owner assigns a community member to the community administrator role through the communities portlet the following occurs:

      1. portlet responds with : You do not have the required permissions.
      2. User is assigned to the role successfully even though the error appeared.
      3. The owner is not capable of REMOVING the assigned administrator role.
      4. The following appears in catalina.out:

      13:16:52,614 ERROR [AdvancedPermissionChecker:619] Bag should never be null
      13:16:52,615 ERROR [AdvancedPermissionChecker:254] java.lang.NullPointerException
      java.lang.NullPointerException
      at com.liferay.portal.security.permission.AdvancedPermissionChecker.isCommunityOwnerImpl(AdvancedPermissionChecker.java:622)
      at com.liferay.portal.security.permission.AdvancedPermissionChecker.isCommunityOwner(AdvancedPermissionChecker.java:251)
      at com.liferay.portal.service.impl.UserGroupRoleServiceImpl.deleteUserGroupRoles(UserGroupRoleServiceImpl.java:81).....
      <<cut>>

        Activity

        Hide
        Arcko Duan (Inactive) added a comment -

        Issue reproduced in trunk.

        Show
        Arcko Duan (Inactive) added a comment - Issue reproduced in trunk.
        Hide
        Gavin Wan (Inactive) added a comment - - Restricted to

        If we can not get the bag from cache we should get it and put it into cache.

        src/com/liferay/portal/security/permission/AdvancedPermissionChecker.java

        line:916

        • if (bag == null) { - _log.error("Bag should never be null"); - }

        + if (bag == null)

        { + List<Group> groups = new ArrayList<Group>(); + + groups.add(user.getGroup()); + + List<Role> roles = RoleLocalServiceUtil.getUserRelatedRoles( + user.getUserId(), groups); + + bag = new PermissionCheckerBagImpl( + user.getUserId(), new ArrayList<Group>(), + new ArrayList<Organization>(), new ArrayList<Group>(), + new ArrayList<Group>(), new ArrayList<Group>(), roles); + + PermissionCacheUtil.putBag( + user.getUserId(), user.getGroup().getGroupId(), bag); + }
        Show
        Gavin Wan (Inactive) added a comment - - Restricted to If we can not get the bag from cache we should get it and put it into cache. src/com/liferay/portal/security/permission/AdvancedPermissionChecker.java line:916 if (bag == null) { - _log.error("Bag should never be null"); - } + if (bag == null) { + List<Group> groups = new ArrayList<Group>(); + + groups.add(user.getGroup()); + + List<Role> roles = RoleLocalServiceUtil.getUserRelatedRoles( + user.getUserId(), groups); + + bag = new PermissionCheckerBagImpl( + user.getUserId(), new ArrayList<Group>(), + new ArrayList<Organization>(), new ArrayList<Group>(), + new ArrayList<Group>(), new ArrayList<Group>(), roles); + + PermissionCacheUtil.putBag( + user.getUserId(), user.getGroup().getGroupId(), bag); + }
        Hide
        Brian Chan added a comment -

        Ok, I checked in a more robust fix. Thanks everyone.

        Show
        Brian Chan added a comment - Ok, I checked in a more robust fix. Thanks everyone.

          People

          • Assignee:
            Gavin Wan (Inactive)
            Reporter:
            James Loope
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development

                Structure Helper Panel