IModulesAccess Interface |
Namespace: AskiaPortalCmn.Common
The IModulesAccess type exposes the following members.
Name | Description | |
---|---|---|
IsModified |
Flag to indicates
if the object has been modified
since his initialization.
|
Name | Description | |
---|---|---|
AllowAccess |
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. | |
CanAccess |
Returns true if the user can
access the module with the specified GUID.
| |
DisallowAccess |
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. | |
GetAllItems |
Returns the list of modules access.
| |
Reload |
Reload the list of modules access
using the current database values.
| |
ResetDefaultAccess |
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. | |
Save |
Save the modification in the database
if the object has been modified.
|
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"); } } } }