System Administrator

Certified Senior Developer

Is there a way to get to know all System Administrator on a given environment? without any plugins.

  Discussion posts and replies are publicly visible

Parents
  • There is a function available isusersystemadministrator() which takes user as input and returns true when user is a SA. You can create a recipe around this rule to get the system administrators of the environment.
  • Hi ,

    I think the best way is not to iterate via all the users in the system. If you have large number of users in the system this can easily become a very slow expression.

    I would suggest you to create a new custom group for example 'AllAdminUsers' and add the admin users to this custom group automatically via a rule. This way we will have a single reference to a group where we do have all the sys admin users.

    group membership rule should look like 'User Type' equals 'Administrator'

    Once you define the rule the custom group will be auto populated with all Sys admins in your system. So no need to iterate through all the users in the system.

    Using below code you can retrieve all admin users.

    fn!getdistinctusers('your group reference') . Here I have used getdistinctuser function. This function is much more faster to retrieve users in a group. (But this function have an upper limit of 10000, but in case of admin users I would never think we will have that many admin users in a system ever :) )

    Hope this helps to simplify and enhance the performance of your requirement.

    Regards
    Suresh
Reply
  • Hi ,

    I think the best way is not to iterate via all the users in the system. If you have large number of users in the system this can easily become a very slow expression.

    I would suggest you to create a new custom group for example 'AllAdminUsers' and add the admin users to this custom group automatically via a rule. This way we will have a single reference to a group where we do have all the sys admin users.

    group membership rule should look like 'User Type' equals 'Administrator'

    Once you define the rule the custom group will be auto populated with all Sys admins in your system. So no need to iterate through all the users in the system.

    Using below code you can retrieve all admin users.

    fn!getdistinctusers('your group reference') . Here I have used getdistinctuser function. This function is much more faster to retrieve users in a group. (But this function have an upper limit of 10000, but in case of admin users I would never think we will have that many admin users in a system ever :) )

    Hope this helps to simplify and enhance the performance of your requirement.

    Regards
    Suresh
Children