IUserProfiles.AddStr

Syntax

AddStr(StrSid: String; Name: String): IUserProfile;

Parameters

StrSid. The string value of the security identifier of the user. This value can be obtained in the ISid.AsString property.

Name. The name of the profile to be added.

Description

The AddStr method adds to the collection the profile with the specified name and binding to the security subject with the specified security identifier.

Comments

Profiles of the user are added to the appropriate collections automatically on the first reference to the IMetabaseUser.Profile property.

The profiles can be added only to the profile collection of the repository, obtained in the IMetabase.Profiles property. The collection can be changed only by the administrator of the repository. On executing the AddStr method the StrSid parameter cannot have empty value. If the identifier which does not correspond to any subject is specified then the local profile will be created. This profile can be used to store any list of email addresses or any parameters. The local profile can be also found by using the FindByStrSid method. If the collection already contains the profile corresponding to the StrSid security identifier, then the exception is generated.

Example

The specified example must be executed as the administrator of the repository.

Sub UserProc;
Var
    Mb: IMetabase;
    Profs: IUserProfiles;
    Prof: IUserProfile;
    Props: IUserProfileProperties;
Begin
    Mb := MetabaseClass.Active;
    Profs := Mb.Profiles;
    Prof := Profs.AddStr(Mb.Name + "_SID", Mb.Name + "_Parameters").Edit;
    Prof.Email := Mb.Name + "@example.ru";
    Props := Prof.Properties;
    Props.Add("Param1""Value1");
    Props.Add("Param2""Value1");
    Prof.Apply;
End Sub UserProc;

After executing the example the local profile will be added to the collection of the repository profiles. In the settings of the profile the default email address and two properties will be specified.

See also:

IUserProfiles