IUserManagedGroups Property |
Namespace: AskiaPortalCmn
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!"); } } } }