Visual Guard Class Library Documentation

VGRoles.AddUserToRoleById Method 

Adds the user specified by the repository id to the specified role.

public static void AddUserToRoleById(
   String userId,
   Guid roleId
);

Parameters

userId
The repository id of the user to add to the specified role.
roleId
the repository id of the roles to add the specified user to.

Exceptions

Exception Type Condition
ArgumentNullException userIds is null.
ArgumentException roleId was not found in the repository for the application.

-or-

userId was not found in the repository.
SecurityException The current user has not enough privileges to use Membership API. The Membership access level of the application must be sufficient to allows this action or the 'Membership Manager' role must be granted to the user by using the Visual Guard console.

See Also

VGRoles Class | Novalys.VisualGuard.Security.Membership Namespace | RepositoryId