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" : "S1!M!S!T1" }, "tArg" : { "pattern" : { "obInst" : "true", "auditOp" : { "operationKey" : "1", "comment" : "Check access permissions for operation execution: Import" } }, "meta" : "" } } }
{ "Fault" : { "faultcode" : "soapenv:Sender", "faultstring" : "Not enough permissions to execute the 'Import' operation on the 'Data Handler'(CUST_OBJ) object in the 'ADMIN' user", "detail" : { "ExceptionDetail" : { "HelpLink" : { "@nil" : "1" }, "InnerException" : { "@nil" : "1" }, "Message" : "Not enough permissions to execute the 'Import' operation on the 'Data Handler'(CUST_OBJ) object in the 'ADMIN' user", "StackTrace" : { "@nil" : "1" }, "Type" : "System.Exception" }, "Error" : { "Message" : "Not enough permissions to execute the 'Import' operation on the 'Data Handler'(CUST_OBJ) object in the 'ADMIN' user", "Code" : "6374", "PiClass" : "CPiObjException", "PiState" : "AAAAAAEAAAAAAAAA5hgAAAsAAAByAAAAHQQ1BDQEPgRBBEIEMARCBD4ERwQ9BD4EIAA\/BEAEMAQyBCAANAQ7BE8EIAAyBEsEPwQ+BDsEPQQ1BD0EOARPBCAAPgQ\/BDUEQAQwBEYEOAQ4BCAAJwBJAG0AcABvAHIAdAAnACAAQQQgAD4EMQRKBDUEOgRCBD4EPAQgACcAHgQxBEAEMAQxBD4EQgRHBDgEOgQgADQEMAQ9BD0ESwRFBCcAKABDAFUAUwBUAF8ATwBCAEoAKQAgAEMEIAA\/BD4EOwRMBDcEPgQyBDAEQgQ1BDsETwQgACcAQQBEAE0ASQBOACcACwAAABMAAABTAG8AbQBcAFMAbwBtAE0AZQB0AGEAYgBhAHMAZQAuAGMAcABwAAAAAADQZAAACwAAAAAAAAALAAAAAAAAAAsAAAAAAAAAAAAAAAAAAAADAAAA" }, "Exception" : "Not enough permissions to execute the 'Import' operation on the 'Data Handler'(CUST_OBJ) object in 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 access permissions for operation execution try { var result = somClient.SetCustomOb(tSet); return true; } catch { return false; } }
See also: