IUserReachableGroups Property |
Namespace: AskiaPortalCmn
This example looks if the user in the context is allowed to reach 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; } // Is allowed to reach the group 5? if (context.User.ReachableGroups.Contains(5)) { Console.WriteLine("You're allowed to reach the group 5!"); } else { Console.WriteLine("You're NOT allowed to reach the group 5!"); } } } }