ILionReposSecurityUser
This section details the functions and properties of the AMT-COBOL Repository Module SecurityUser interface
Properties
| Name | Type | Access | Description | 
| Deleted | Boolean | Read/Write | If the user is deleted or not | 
| Groups | Read-Only list of ILionReposSecurityGroup Objects | Read only | Get a read-only list of groups this user belongs to | 
| UserName | String | Read only | Get the user name | 
Functions
| Function name | Return type | Parameters | Description | |
| Name | Type | |||
| AddGroup | Void | Group | ILionReposSecurityGroup Object | Add group to the list of groups this users belongs to | 
| ClearGroups | Void | Clear the groups and mark as loaded | ||
| HasGroup | Boolean | Group | ILionReposSecurityGroup Object | Checks if the user belongs to the specified group or not | 
| LoadGroups | Void | Repos | ILionRepository Object | Load the groups from the database | 
| RemoveGroup | Void | Group | ILionReposSecurityGroup Object | Remove the group from the list of groups this users belongs to | 
| SaveGroups | Void | Repos | ILionRepository Object | Save the groups to the database | 
Example
C#
// Retrieve the security groups of user JDOE
        ILionReposSecurityUser securityUser = security.FindUserByName("JDOE");
securityUser.LoadGroups(repos);
    
        // Add all the current security groups of user JDOE to a new user
        ILionReposSecurityUser defaultUser = security.AddUser("DefaultDeveloper");
        foreach (ILionReposSecurityGroup Group
        in securityUser.Groups) {
 
         defaultUser.AddGroup(Group);
}
defaultUser.SaveGroups(repos);
    
        // Clear all the current security groups of user JDOE and add the user to the DevOps
            security group
        securityUser.ClearGroups();
        securityUser.AddGroup(securityGroup);
        securityUser.SaveGroups(repos);
    
PowerShell
# Retrieve the security groups of user JDOE
        $O_SecurityUser = $O_Security.FindUserByName("JDOE")
        $O_SecurityUser.LoadGroups($O_Repos)
    
# Add all the current security groups of user JDOE to a new user
        $O_DefaultUser = $O_Security.AddUser("DefaultDeveloper")
        foreach ($Group in $O_SecurityUser.Groups)
        {
          $O_DefaultUser.AddGroup($Group)
        }
        $O_DefaultUser.SaveGroups($O_Repos)
    
# Clear all the current security groups of user JDOE and add the user to the DevOps
            security group
        $O_SecurityUser.ClearGroups()
$O_SecurityUser.AddGroup($O_SecurityGroup)
        $O_SecurityUser.SaveGroups($O_Repos)
    
