1 Reply Latest reply on Mar 16, 2015 9:55 PM by sourabh_lonikar

    How to programatically check for Space & Group admins ?

      We have requirement to show link only to root, space and social group admins. This should not include admins from 'Permissions' tab like 'Manage Community', 'Manage System', 'Moderate Content' etc.
      While exploring, I encountered two methods which seem to fit usage:
                                       BasePermHelper.isContainerAdmin(user, container)       &&       BasePermHelper.isGlobalModeratorNoAdmin(user)
      They return following responses:


      isContainerAdmin(user)  returns true for Space Container Creator/Owner, user with 'Moderate Content' and user with 'Manage Community' and user with combination of these. While BasePermHelper.isGlobalModeratorNoAdmin(user) is true only for 'Moderate Content' is checked irrespective of other kinds of admin user might be. It basically acts as checkbox verifier for 'Moderate Content'.
      How do verify whether user is only 'Moderate Content' admin / 'Manage Community' only and is not other kinds of admin at same time ? Are there other methods to determine the same ?
      Current arrangement ends up rejecting user if he/she has 'Moderate Content' checked for him even though user may be owner of container.
      ** Edit **
      To frame a very specific question:
      Q:  How to programmatically determine whether a user is creator / administrator of specific space/ social group solely for specific container without being influenced by Permissions Tab admin checks ?
      Thanks and Regards,
        • Re: How to programatically check for Space & Group admins ?

          In order to determine community & social group admin without influence of 'Moderate Content', I have used following methods as additional checks:


          CommunityPermHelper.isCommunityAdmin((Community) container, user) && SocialGroupPermHelper.isSocialGroupOwner((SocialGroup) container, user)


          It does not consider 'Manage Content' admin as corresponding community/ social group admin.

          Above methods also consider whether admin is spcific container admin or global community/ social group admin. Unfortunately I am unable to remove influence of 'Manage Community' admin which is applicable for space.