Below is the example of using the SetCustomOb operation for checking access permissions of the current user for custom class object operation execution. The request contains moniker of custom class object and the operation, which executabilty must be checked. If the operation can be executed, the response returns object moniker; if the operation cannot be executed, the error is returned containing a reason of operation execution denial. The appropriate record is logged into access protocol.
{
"SetCustomOb" :
{
"tCustomOb" :
{
"id" : "LDPFDGAHAHHCGOAEBAFLLHKHMOALEEDEMKDKCJAAKNELDHAE!M!S!TGHNHGJAHAHHCGOAENBPOBGJCGMEKKAFEILDEOPPCHPKFAHNO"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"parsOwnDefVals" : "true",
"auditOp" :
{
"operationKey" : "1",
"comment" : "Check access permissions for operation execution: Import"
}
},
"meta" : ""
}
}
}
{
"Fault" :
{
"faultcode" : "soapenv:Sender",
"faultstring" : "Not enough rights to perform the 'Unknown operation' operation with the 'Data handler' (CUST_OBJ) object of the 'ADMIN' user",
"detail" :
{
"ExceptionDetail" :
{
"HelpLink" :
{
"@nil" : "1"
},
"InnerException" :
{
"@nil" : "1"
},
"Message" : "Not enough rights to perform the 'Unknown operation' operation with the 'Data handler' (CUST_OBJ) object of the 'ADMIN' user",
"StackTrace" :
{
"@nil" : "1"
},
"Type" : "System.Exception"
},
"Error" :
{
"Message" : "Not enough rights to perform the 'Unknown operation' operation with the 'Data handler' (CUST_OBJ) object of the 'ADMIN' user",
"Code" : "6374",
"PiClass" : "CPiObjException",
"PiState" : "AAAAAAEAAAAAAAAA5hgAAAsAAACBAAAAHQQ1BDQEPgRBBEIEMARCBD4ERwQ9BD4EIAA\/BEAEMAQyBCAANAQ7BE8EIAAyBEsEPwQ+BDsEPQQ1BD0EOARPBCAAPgQ\/BDUEQAQwBEYEOAQ4BCAAJwAdBDUEOAQ3BDIENQRBBEIEPQQwBE8EIAA+BD8ENQRABDAERgQ4BE8EJwAgAEEEIAA+BDEESgQ1BDoEQgQ+BDwEIAAnAB4EMQRABDAEMQQ+BEIERwQ4BDoEIAA0BDAEPQQ9BEsERQQnACAAKABDAFUAUwBUAF8ATwBCAEoAKQAgAEMEIAA\/BD4EOwRMBDcEPgQyBDAEQgQ1BDsETwQgACcAQQBEAE0ASQBOACcACwAAACAAAAAuAC4AXABNAG8AZABcAEsAZQBTAG8AbQBcAFMAbwBtAFwAUwBvAG0ATQBlAHQAYQBiAGEAcwBlAC4AYwBwAHAAAAAAAFl0AAALAAAAAAAAAAsAAABeAAAAdgBvAGkAZAAgAF8AXwBjAGQAZQBjAGwAIABDAFMAbwBtAE0AZQB0AGEAYgBhAHMAZQA6ADoAQwBDAGgAZQBjAGsAQQBuAGQAQQB1AGQAaQB0ADoAOgBFAHIAcgBvAHIAKABjAG8AbgBzAHQAIABzAHQAcgB1AGMAdAAgAEMAUwBvAG0ATQBlAHQAYQBiAGEAcwBlADoAOgBDAEMAaABlAGMAawBSAGUAcwAgACYAKQAgAGMAbwBuAHMAdAALAAAAAAAAAAAAAAAAAAAAAwAAAA=="
},
"Exception" : "Not enough rights to perform the 'Unknown operation' operation with the 'Data handler' (CUST_OBJ) object of the 'ADMIN' user"
}
}
}
public static bool SetCustomObCheckAndAudit(CustomObId moniker, CustomOperation operation)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetCustomOb()
{
tArg = new SetCustomObArg()
{
pattern = new CustomObMdPattern()
{
auditOp = new ObAuditOp()
{
operationKey = operation.k,
comment = "Check access permissions for operation execution: " + operation.n
}
},
meta = new CustomObMd()
},
tCustomOb = moniker
};
// Check operation execution access permissions
try
{
var result = somClient.SetCustomOb(tSet);
return true;
}
catch
{
return false;
}
}
See also: