HasAccess(SecurityDescriptor: ISecurityDescriptor; DesiredAccess: Integer): Boolean;
SecurityDescriptor. Repository object security parameters.
DesiredAccess. Mask that determines operations, the availability of permissions to which it is necessary to check for the user. It is necessary to use values of the MetabaseObjectPredefinedRights enumeration type to form mask value. This enumeration contains basic and additional operations, on which permissions can be granted and access auditing can be executed. The specific operations are available for defined object classes. To use specific operations depending on the object class in a mask there is a possibility to use values of the following enumerations:
CalculatedCubeSpecificRights - specific operations available for calculated cubes.
CubeLoaderSpecificRights - specific operations available for cube data loader.
CubeSpecificRights - specific operations available for various types of cubes.
CustomObjectSpecificRights - specific operations available for custom class objects.
DataBaseSpecificRights - specific operations available for the Database repository object.
DictionarySpecificRights - specific operations available for the MDM Dictionary and Composite MDM Dictionary repository objects.
MDCalcSpecificRights - specific operations available for the Multidimensional Calculation on DB Server repository object.
ProblemSpecificRights - specific operations available for the Modeling Problem modeling container object.
ProcedureSpecificRights - specific operations available for the Procedure repository object.
ScenarioDimensionSpecificRights - specific operations available for the Modeling Scenario repository object.
TableSpecificRights - specific operations available for the following repository objects: Table, View, Log, External Table.
ValidationSpecificRights - specific operations available for the Validation Rule and Validation Group repository object.
The HasAccess method checks the availability of the user permissions for specific operations with objects.
Operations, the availability of permissions to which should be checked, are sent by the DesiredAccess parameter. If the user has permissions to all the specified operations, the method returns True, otherwise the method returns False.
Executing the example requires that the repository contains an object with the Obj_1 identifier. There is the TestUser user among the security subjects that were created in the security manager of the current repository.
Sub Main;
Var
MB: IMetabase;
User: IMetabaseUser;
MObj: IMetabaseObjectDescriptor;
Begin
MB := MetabaseClass.Active;
User := MB.Security.ResolveName("TestUser") As IMetabaseUser;
MObj := MB.ItemById("Obj_1");
Debug.WriteLine(User.HasAccess(MObj.SecurityDescriptor,
MetabaseObjectPredefinedRights.ExportData Or
MetabaseObjectPredefinedRights.ImportData));
End Sub Main;
After executing the example an indicator of availability of permissions of the TestUser user to export and import the data of the object with the Obj_1 identifier is displayed in the development environment console.
See also: