I am developing a customization and would like to check if a user has access to a specific screen (or a Graph for that matter) in my code, I need to perform certain actions if they do not. How would I do that in my graph, which is not the same graph/screen?
Solved
Check user access to a screen
Best answer by countrdd
// Replace with the screen ID you want to check, e.g., "AR301000" for AR Invoices and Memos
const string screenID = "AR301000";
// Check if the user has access to the screen
if (!PXAccess.VerifyRights(screenID))
{
// User does not have access - handle the logic here
throw new PXException("You do not have access to the required screen: {0}", screenID);
}
var graphType = typeof(PX.Objects.AR.ARInvoiceEntry);
if (!PXAccess.VerifyRights(graphType))
{
// User does not have access - handle the logic here
throw new PXException("You do not have access to the required Graph: {0}", graphType.Name);
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.