Click or drag to resize

IUserReachableGroups Property

Indicates which groups are reachable by the user.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
IReachableGroups ReachableGroups { get; }

Property Value

Type: IReachableGroups
Examples

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!");
                }

         }
    }
}
See Also