IManagedGroups Interface |
Namespace: AskiaPortalCmn
The IManagedGroups type exposes the following members.
Name | Description | |
---|---|---|
IsModified |
Flag to indicates if the object has been modified since his initialization
|
Name | Description | |
---|---|---|
Add(IListInt32) |
Add groups to manage It will not save the change in the database unless you explicitly save the user | |
Add(Int32) |
Add a group to manage It will not save the change in the database unless you explicitly save the user | |
Clear |
Clear the list of all managed group. It will not save the change in the database unless you explicitly save the user | |
Contains |
Returns true if the user can manage the group with the specified id
| |
GetAllIds |
Returns the entire list of group ids managed by the user
| |
GetIds |
Returns the non-recursive list of group ids managed by the user
| |
Reload |
Reload the managed groups using the current database values
| |
Remove(IListInt32) |
Remove groups from the management It will not save the change in the database unless you explicitly save the user | |
Remove(Int32) |
Remove a group from the management It will not save the change in the database unless you explicitly save the user | |
Save |
Save the modification in the database if the object has been modified.
|
This example looks if the user in the context can manage the group with id 5
using system; using AskiaPortalCmn; namespace MyApp { class Program { static void Main(string[] args) { var context = ContextFactory.CreateByLoginAndPassword("login", "secret"); var contextValidation = context.Validate(); if (!contextValidation.Success) { Console.Error.WriteLine("Invalid context"); Console.Error.Write(contextValidation.Exception.Message); return; } // First look if the user have a permission to at least see groups if (context.User.Permissions[AccessTo.Groups] == AccessLevel.None) { Console.WriteLine("You don't have enough permission to access groups"); return; } if (context.User.ManagedGroups.Contains(5)) { Console.WriteLine("You're allowed to manage the group 5!"); } else { Console.WriteLine("You're NOT allowed to manage the group 5!"); } } } }