A GAM user can be enabled in more than one GAM Repository, and its purpose is to let the user connect to any of the repositories where he is enabled.
A User can connect to a repository only if he's enabled on it, and can connect to only one repository at a time. The GAM Security Policies, GAM Permissions and GAM Roles are taken from the GAM Application of the Repository he is connected to.
One possible scenario where a user is enabled on more than one repository is when a company has different branches, and the user connects to any of the branches using the same credentials (he may have different access levels in each company). See Multiple Repositories Scenario: A company with different branches for details on this scenario.
The condition for a user to be enabled in a repository is that he has the same Namespace as the repository.
Users can only be created in a repository if the GAM connection is established to that repository. Then, the user's Namespace is always initialized with the Repository's Namespace where he is created.
By default, users are automatically enabled in the repository where they are created.
Additionally, a user can be enabled on any other repository as long as the repository has the same namespace as the user.
Take a look at the GAMExampleWWUsers object. There, the users are listed, regardless if they are enabled or not in the repository, and they are displayed with a different look and feel in each case.
If you want to list only the enabled users, only the disabled users, or all, use the IsEnabledInRepository property of the GAMUserFilter object, as shown in the following code:
&Filter_Name.IsEnabledInRepository = GAMBooleanFilter.False //Domain type whose values are TRUE, FALSE, ALL
&Users= GAMRepository.GetUsersOrderBy(&Filter_Name, GAMUserListOrder.None, &Errors)
The code to enable or disable a user in the current GAM Repository (where the GAM connection is established) is as follows:
&isOK = &User.RepositoryDisable(&Errors)
&isOK = &User.RepositoryEnable(&Errors)
If not &isOK
For &Error in &Errors
Msg(Format(!"%1 (GAM%2)", &Error.Message, &Error.Code))
Note that the objective of the IsEnabledRepository property of the GAMUser object is to know whether or not a user is enabled on the GAM Repository. It returns a Boolean data type.
&User.Load(&UserId) //&UserId is GAMGUID data type
&IsEnabledInRepository = &User.IsEnabledInRepository
User Activation Method Repository property