Click or drag to resize

IModulesAccess Interface

Accessor to the list of modules access for the user or the user profile.

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

The IModulesAccess 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 methodAllowAccess
Allow the user or the user profile to access the specified module.
It will not save the change in the database unless you explicitly call the Savefrom the current object or the user/user profile.
Public methodCanAccess
Returns true if the user can access the module with the specified GUID.
Public methodDisallowAccess
Disallow the user or the user profile to access the specified module.
It will not save the change in the database unless you explicitly call the Save from the current object or the user/user profile.
Public methodGetAllItems
Returns the list of modules access.
Public methodReload
Reload the list of modules access using the current database values.
Public methodResetDefaultAccess
Reset the default access to the specified module.
It will not save the change in the database unless you explicitly call the Save from the current object or the user/user profile.
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 can access the `administration` module.

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.Write(contextValidation.Exception.Message);
                    return;
                }

                var adminGuid = Guid.Parse("D55A91F3-F3EC-49F7-A26C-3701C0E95001");
                if (context.User.Modules.CanAccess(adminGuid))
                {
                    Console.WriteLine("You're allowed to access the `administration` module");
                }
                else
                {
                    Console.WriteLine("You're NOT access the `administration` module");
                }
         }
    }
}
See Also