ILionReposSecurity
This section details the functions and properties of the AMT-COBOL Repository Module Security interface
Functions
Function name | Return type | Parameters |
Description | |
Name |
Type |
|||
AddGroup |
ILionReposSecurityGroup Object |
GroupName |
String | Add the group to the database and memory |
AddUser | ILionReposSecurityUser Object | UserName | String | Add the user to the database and memory |
FindGroupByName | ILionReposSecurityGroup Object |
GroupName | String | Find a group by its name |
FindUserByName | ILionReposSecurityUser Object |
UserName | String | Find a user by its name |
GetLabelPermissions | ILionLabelPermissions Object | Group | ILionReposSecurityGroup Object |
Gets the label permissions for the specified group |
Label | ILionLabel Object | |||
GetPermissions | ILionReposPermissions Object | App | ILionApplication Object | Returns the permissions for the provided application/genset/group Please note that the user which is using the repository API, needs to be system administrator in the repository to use the GetPermissions and SavePermissions methods. |
GenSet | ILionGenSet Object | |||
Group | ILionReposSecurityGroup Object | |||
HasLabelRight | Boolean | Label | ILionLabel Object | Check whether the current user is allowed to execute the provided action to the label |
Action | LionLabelRightAction Object | |||
HasRight | Boolean | App | ILionApplication Object | Check if the current user has the right to perform the selected action |
GenSet | ILionGenSet Object | |||
Action | LionRightAction Object | |||
ObjectType | LionObjectType Object | |||
MarkUserAsDeleted | Void | UserSec | ILionReposSecurityUser Object | Mark the user as deleted in the database and memory |
RemoveGroup | Void | GroupSec | ILionReposSecurityGroup Object | Remove the group from the database and memory |
ReturnAllGroups | List of ILionReposSecurityGroup Objects |
Return a list of all groups |
||
ReturnAllUsers | List of ILionReposSecurityUser Objects |
Return a list of all users |
||
SaveLabelPermissions | Void | Label | ILionLabel Object | Saves the label permissions to the repository |
Permissions | ILionLabelPermissions Object | |||
SavePermissions | Void | App | ILionApplication Object | Saves the permissions for the provided application/genset/group Please note that the user which is using the repository API, needs to be system administrator in the repository to use the GetPermissions and SavePermissions methods. |
GenSet | ILionGenSet Object | |||
Group | ILionReposSecurityGroup Object | |||
Permissions | ILionReposPermissions Object | |||
UnDeleteUser | ILionReposSecurityUser | UserSec | ILionReposSecurityUser Object | Undelete the specified user |
Enumerations
Name | Type | Enumeration |
LionLabelRightAction Namespace: Asysco.Lion.Repository.Enums For a description of the label right actions, see ILionLabelPermissions |
Int |
|
LionRightAction |
Int |
|
Example
C#
ILionReposSecurity security = repos.GetSecurity();
ILionReposSecurityGroup testGroup = security.FindGroupByName("Test");
if (testGroup == null) {
Log("Error locating group");
}
// Check whether the current user is allowed to look into the DEMO2 application
bool lookInto = security.HasRight(app, genSet, LionRightAction.LookInto, LionObjectType.ApplicationKindLionASeries);
// Retrieve the permissions for the Test group in for the DEMO2 application in the Test genset
ILionReposPermissions permissions = null;
try {
permissions = security.GetPermissions(app, genSet, testGroup);
} catch {
Log("You are not authorized to retrieve repository permissions");
return;
}
// Allow the test group to look into the DEMO2 application in the default genset
try {
permissions.LookInto = false;
security.SavePermissions(app, genSet, testGroup, permissions);
} catch {
Log("You are not authorized to retrieve repository permissions");
return;
}
PowerShell
$O_Security = $O_Repos.GetSecurity()
$O_TestGroup = $O_Security.FindGroupByName("Test")
if ($O_TestGroup -eq $null) {
Write-Error("Error locating group")
}
# Check whether the current user is allowed to look into the DEMO2 application
$O_LookInto = $O_Security.HasRight($O_App, $O_GenSet, $O_RightActions::LookInto, $O_ObjectTypes::ReportUser)
# Retrieve the permissions for the Test group in for the DEMO2 application in the default genset
try {
$O_Permissions = $O_Security.GetPermissions($O_App, $O_GenSet, $O_TestGroup)
} catch {
Write-Error "You are not authorized to retrieve repository permissions"
}
# Allow the test group to look into the DEMO2 application in the default genset
try {
$O_Permissions.LookInto = $true
$O_Security.SavePermissions($O_App, $O_GenSet, $O_TestGroup, $O_Permissions)
} catch {
Write-Error "You are not authorized to save repository permissions"
}