LockedState: MetabaseUserLockedState;
The LockedState property determines a state of the user locking.
If the LockedForever state is set, there will be no possibility to unlock the user. The user that has the "Creation, removal of the users" privilege can lock anther user. ADMIN has this privilege by default.
To execute the example, make sure that security manager contains the USER user.
Add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
User: IMetabaseUser;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Lock the USER user
User := MS.ResolveName("USER") As IMetabaseUser;
User.LockedState := MetabaseUserLockedState.LockedForever;
// Save changes
MS.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MS: IMetabaseSecurity;
User: IMetabaseUser;
Lic: Object;
Begin
MB := Params.Metabase;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
// Lock the USER user
User := MS.ResolveName("USER") As IMetabaseUser;
User.LockedState := MetabaseUserLockedState.meuslostLockedForever;
// Save changes
MS.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example the USER user will be locked forever.
See also: