The GAMApplication object of GeneXus Access Manager Library provides methods that can be used to add, update, and delete GAM Permissions in the Application.
Before adding Permissions to Users or to Roles, the Permission needs to be added in any of the applications of the Repository.
This can be done using the GAM Backoffice or just programmatically using the GAM API.
GAMApplication.AddPermission(in:GAMApplicationPermission,out:GAMError Collection) : Boolean
In order to add a new Permission in the Application, you need to define a GAMApplicationPermission object type variable.
&GAMApplicationPermission = new()
&GAMApplicationPermission.Name = 'MyPermission1'
&GAMApplicationPermission.Description = 'MyPermission1'
&GAMApplicationPermission.AccessType = GAMPermissionAccessTypeDefault.Restricted //Possible values are Allow, Deny, Restricted
&isok = &Application.AddPermission(&GAMApplicationPermission,&Errors)
if &isok
commit
else
For &Error in &Errors
Msg(Format(!"%1 (GAM%2)", &Error.Message, &Error.Code))
EndFor
endif
GAMApplication.UpdatePermission(in:GAMApplicationPermission,out:GAMError Collection) : Boolean
GAMApplication.DeletePermission(in:GAMApplicationPermission,out:GAMError Collection) : Boolean