Is it possible to only allow certain roles to post with a specific Task? We want certain users to only be able to post using Task ‘80’ in our system for example.
Solved
Block certain user groups posting with certain Tasks
Best answer by aiwan
I don’t believe this is possible with restrictions like access rights or row-level security.
You could do this via customisation something like this would work:
public static bool IsUserRole(string roleName, PXGraph graph)
{
string usrName = graph.Accessinfo.UserName;
UsersInRoles assignedRoles = SelectFrom<UsersInRoles>.
Where<UsersInRoles.username.IsEqual<P.AsString>.
And<UsersInRoles.rolename.IsEqual<P.AsString>>>.View.Select(graph, usrName, roleName);
if (assignedRoles == null)
return false;
else return true;
}
//I am not 100% sure of the field name here.
protected virtual void _(Events.FieldUpdated<CRActivity.category> e, PXFieldUpdated b)
{
CRActivity row = e.Row;
if (row == null)
return;
if (IsUserRole("someUserRole", Base))
return;
else
e.Cache.RaiseExceptionHandling<CRActivity.category>(row, new PXSetPropertyException<CRActivity.category>("Priority is required"));
}
Login to the community
No account yet? Create an account
Social Login
Login with your Acumatica accountEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
