Click or drag to resize

IReachableGroups Interface

Accessors to the list of groups reachable by the user/group

Namespace:  AskiaPortalCmn.Common
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public interface IReachableGroups

The IReachableGroups type exposes the following members.

Properties
  NameDescription
Public propertyIsModified
Flag to indicates if the object has been modified since his initialization.
Top
Methods
  NameDescription
Public methodAdd(IListInt32)
Add groups to reach
It will not save the change in the database unless you explicitly save the user/group.
Public methodAdd(Int32)
Add a group to reach.
It will not save the change in the database unless you explicitly save the user/group.
Public methodClear
Clear the list of all reachable groups.
It will not save the change in the database unless you explicitly save the user/group.
Public methodContains
Returns true if the user/group can reach the group with the specified id.
Public methodGetAllIds
Returns the entire list of group ids reachable by the user/group.
Public methodGetIds
Returns the non-recursive list of group ids reachable by the user/group
Public methodReload
Reload the rechable groups using the current database values.
Public methodRemove(IListInt32)
Remove groups from the reachability.
It will not save the change in the database unless you explicitly save the user/group.
Public methodRemove(Int32)
Remove a group from the reachability.
It will not save the change in the database unless you explicitly save the user/group.
Public methodSave
Save the modification in the database if the object has been modified.
Top
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