miraks
3 years agoCreator II
How to use GrantIdentity ?
Hi,
On ARAS R12, in server methods, I needed to grant temporary some rights.
For that, I did something like this:
var myidentity = Aras.Server.Security.Identity.GetByName("My Identity");
bool PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity();
try {
/**************YOUR SPECIAL CODE HERE***************/
finally
{
if (PermissionWasSet) Aras.Server.Security.Permissions.RevokeIdentity(myidentity);
}
Due to deprecated API, on ARAS R19, I need to use CCO.Permissions.GrantIdentity but this method doesn't return a boolean to know if the identity has been granted or not.
How should I do ? When and how to do the RevokeIdentity ?
Is this enough ?
using (CCO.Permissions.GrantIdentity(Aras.Server.Security.Identity.GetByName("My Identity")))
{
/**************YOUR SPECIAL CODE HERE***************/
}
Thank you in advance for your answer.