I’ve never done this...so probably a stupid question…
On the Tasks screen, the customer wants to limit modifications to a task to the person who created the task, or someone in the Administrator role.
What I’ve tried so far it is using the RowUpdating event to catch the update and cancel if not the owner or a user in the admin role.
protected void _(Events.RowUpdating<CRActivity> e)
{
var row = (CRActivity)e.Row;
var currentUser = CommonServiceLocator.ServiceLocator.Current.GetInstance<ICurrentUserInformationProvider>().GetUserId();
if (currentUser != row.CreatedByID)
{
var listOfRoles = ListRoleRight.GetRoleRightIdentifier(Roles.descr.IsEqual<"Administrator">, Base);
//if not in admin role, cancel update
}
}
I was going to try to get a list of roles for the current user and see if it is an admin. Poked around in Acumatica code to find where it might be done somewhere else that I can copy from.
This line does not compile (obviously), but it’s where I’m at in trying to find a way to do this:
var listOfRoles = ListRoleRight.GetRoleRightIdentifier(Roles.descr.IsEqual<"Administrator">, Base);
I was going to get a list of roles for the current user and cycle through them to see if the user in in the Administrator role.
Any help you can offer is greatly appreciated.
Thanks,
Joe