function JwGetPrivilegeScope(const Privileges: array of TJwString; const SetType: TJwPrivilegeSetType = pst_Enable): IJwPrivilegeScope;
|
Parameters |
Description |
|
const SetType: TJwPrivilegeSetType = pst_Enable |
defines whether the privileges should be enabled or disabled. Define pst_EnableIfAvail if you dont want to raise an exception if the privlege does not exist. |
|
defines |
a list of privileges to be enabled. |
JwGetPrivilegeScope creates a new privilege scope instance and activates all privileges specified in parameter Privileges. These privileges will be disabled on destruction of this instance. The instance will be automatically be destroyed if the instance pointer runs out of scope.
var P : IJwPrivilegeScope; begin try P := JwGetPrivilegeScope([SE_SHUTDOWN_NAME, SE_TCB_NAME, SE_SECURITY_NAME]); except on E : EJwsclPrivilegeException do //do things on error and exit end; //do things on success that needs privileges enabled end; //here the privileges are automatically disabled
There is no need for an exception handling if parameter SetType is set to pst_EnableIfAvail.
|
Exceptions |
Description |
|
will be raised if the privilege is not available and query is pst_Enable, otherwise the return value is false. If query is pst_EnableIfAvail the return is false, if the privilege could not be enabled. In this case no exception is raised. If an exception is raised all privileges enabled to this point are disabled |
|
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc. |
|
What do you think about this topic? Send feedback!
|