Custom Module Permissions

Posted by Community Admin on 05-Aug-2018 23:25

Custom Module Permissions

All Replies

Posted by Community Admin on 29-Dec-2010 00:00

Hi,

I'm new to Sitefinity...

I'm trying to develop a simple Sitefinity 4.0 module. One of the first things I noticed while using the administrative portion of the built-in modules is that they all have a list of actions that can be performed and who can perform them. For example, the events module has: "View event", "Create event", and so on. These restrictions can usually be defined by navigating to Settings > Permissions. My questions are:

-When and how should a module register the "actions" that it supports as well as the roles that are allowed by default?

-How should a module display these settings? (When the user clicks Settings > Permissions).

Thanks

Posted by Community Admin on 30-Dec-2010 00:00

Hello Nelson,

In 4.0 you have views which are defined by module definitions. The definition is created by definition elements which are similar to controls. Inside the definition you need to have methods which use DialogElement class and DefinitionsHelper.CreateDialogElement method. You can take a look at this post.

Basically you can add the permissions by creating an instance of  CommandWidgetElement

CommandWidgetElement modulePermissions = new CommandWidgetElement(settings.Items)
           
               Name = "ModulePermissions",
               CommandName = DefinitionsHelper.PermissionsCommandName,
               ButtonType = CommandButtonType.SimpleLinkButton,
               Text = "PermissionsForMyModule",
               ResourceClassId = typeof(ModuleResources).Name,
               WidgetType = typeof(CommandWidget),
               IsSeparator = false
           ;
           settings.Items.Add(modulePermissions );

We will have a sample module -Products for the official release where you will be able to see how to create custom module, definition class, dialogs, custom controls etc.

Kind regards,
Ivan Dimitrov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

This thread is closed