static void RB_FindAndAddMenuItemsToPrivileges(Args _args)
{
SecurityTask securityTask;
SecurityTaskEntryPoint SecurityTaskEntryPoint;
SecurableObject securableObj;
TreeNode objTreeNode;
str licenseType;
SecurableName menuItemName;
#Properties
#AOT
#define.PropertyReadUserLicense('ViewUserLicense')
#define.PropertyFullAccessUserLicense('MaintainUserLicense')
objTreeNode = TreeNode::findNode(@"\Menu Items\Display\");
if (objTreeNode)
{
objTreeNode = objTreeNode.AOTfirstChild();
/*
change objTreeNode object properties
*/
while (objTreeNode)
{
licenseType = objTreeNode.AOTgetProperty(#PropertyFullAccessUserLicense);
menuItemName = objTreeNode.AOTgetProperty(#PropertyName);
if (licenseType == 'Functional')
{
select securableObj
where securableObj.Name == menuItemName
&& securableObj.Type == SecurableType::MenuItemDisplay;
if (securableObj)
{
select securityTask
where securityTask.AotName == 'DisplayMenuFunctional_SPF';
SecurityTaskEntryPoint.EntryPoint = securableObj.RecId;
SecurityTaskEntryPoint.SecurityTask = securityTask.RecId;
SecurityTaskEntryPoint.PermissionGroup = AccessRight::Delete;
SecurityTaskEntryPoint.insert();
}
else
{
info(strFmt("%1, MenuItem not exist", objTreeNode.AOTgetProperty(#PropertyName)));
}
}
objTreeNode = objTreeNode.AOTnextSibling();
}
}
}
{
SecurityTask securityTask;
SecurityTaskEntryPoint SecurityTaskEntryPoint;
SecurableObject securableObj;
TreeNode objTreeNode;
str licenseType;
SecurableName menuItemName;
#Properties
#AOT
#define.PropertyReadUserLicense('ViewUserLicense')
#define.PropertyFullAccessUserLicense('MaintainUserLicense')
objTreeNode = TreeNode::findNode(@"\Menu Items\Display\");
if (objTreeNode)
{
objTreeNode = objTreeNode.AOTfirstChild();
/*
change objTreeNode object properties
*/
while (objTreeNode)
{
licenseType = objTreeNode.AOTgetProperty(#PropertyFullAccessUserLicense);
menuItemName = objTreeNode.AOTgetProperty(#PropertyName);
if (licenseType == 'Functional')
{
select securableObj
where securableObj.Name == menuItemName
&& securableObj.Type == SecurableType::MenuItemDisplay;
if (securableObj)
{
select securityTask
where securityTask.AotName == 'DisplayMenuFunctional_SPF';
SecurityTaskEntryPoint.EntryPoint = securableObj.RecId;
SecurityTaskEntryPoint.SecurityTask = securityTask.RecId;
SecurityTaskEntryPoint.PermissionGroup = AccessRight::Delete;
SecurityTaskEntryPoint.insert();
}
else
{
info(strFmt("%1, MenuItem not exist", objTreeNode.AOTgetProperty(#PropertyName)));
}
}
objTreeNode = objTreeNode.AOTnextSibling();
}
}
}
No comments:
Post a Comment