GetAccessSecurity(Options: Integer): IAccessObjectSecurity;
Options. The parameter is not used, it is reserved for the future. To enable method work, set any value.
The GetAccessSecurity method gets policy of access to object.
Executing the example requires that the repository contains an MDM dictionary with RDS_DICT identifier. The user executing the example should have the privilege Changing Security Label and Access Control List of Any Object.
Add links to the Metabase, Rds system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Object: IMetabaseObject;
MS: IMetabaseObjectSecurity;
AOS: IAccessObjectSecurity;
Iterator: IAccessElementsIterator;
Level: Integer;
Element: IAccessElement;
AttributeValue: IAccessAttributeValue;
Begin
// Get the current repository
MB := MetabaseClass.Active;
// Get MDM dictionary
MObj := MB.ItemById("RDS_DICT");
Object := MObj.Edit;
MS := MObj As IMetabaseObjectSecurity;
// Check if discretionary access control is used for MDM dictionary elements
If MS.AccessSecured Then
// Change access permissions for the first dictionary element
AOS := MS.GetAccessSecurity(1);
Iterator := AOS.GetElements;
Level := Iterator.Next;
Element := Iterator.Current;
Element := Element.Edit;
Debug.WriteLine(Element.Name);
AttributeValue := New AccessAttributeValue.Create(32,12);
Element.AttributeAccess(AccessElementAttributes.Read) := AttributeValue;
Element.Apply(AccessElementApplyOptions.ByHierarhy);
// Save changes
Object.Save;
End If;
End Sub UserProc;
After executing the example, read permissions are changed for the first element of MDM dictionary and all its child elements. There is no access to these elements for the first two security subjects.
See also: