Code to check for current user have admin rights
Str CcuruserID;
UserInfo userInfo;
UserGroupList UserGroupList1;
;
CcuruserID=curuserID();
#Admin
info(CcuruserID);
select firstfast UserGroupList1 where
UserGroupList1.groupId == #AdminUserGroup
&& UserGroupList1.UserId == curuserid();
if (UserGroupList1)
info("Current User have admin rights");