Monday, February 1, 2010

Check whether Current User is in Admin Group

If you want to check the current user is in the Admin group, use the UserGroupList system table. You can extend this code to check if a user is in a particular security group or not.

 

//check the UserGroupList system table if the current user is in there

#Admin

boolean canDoStuff()

{

    boolean ret;

    UserGroupList groupList;

    ;

   

    select firstfast groupList where

        groupList.groupId == #AdminUserGroup

        &&  groupList.UserId == curuserid();

 

    if (groupList)

        ret = true;

    else

        ret = false;

       

    return ret;

}

1 comment: