Search This Blog

July 19, 2012

How to Assig access rights in Axapta between users

 How to Assig access rights in Axapta between users

Assignment of access rights for the users is a very frequent task. This script helps to assign or replicate the access rights between users instantly.

// Script for assigning/swapping access rights between users.
static void assignAccessRights(Args _args)
UserGroupList groupList,groupListIns;
str 10 frmUser, toUser;

frmUser = 'usr1';
toUser = 'usr2' ;

// To delete the existing permissions of the toUser
delete_from groupList
where groupList.UserId == toUser;

while select groupList
where groupList.userId == frmUser
info(strfmt('Group assigned: %1',groupList.groupId));
select forupdate groupListIns
where groupListIns.userID == toUser
&& groupListIns.GroupId == groupList.GroupId;

groupListIns.UserId = toUser;
groupListIns.GroupId = groupList.GroupId;
info(strfmt('Permissions changed from: %1 to: %2',frmUser,toUser));


No comments:

Post a Comment