Search
AppTheory - app.the.o.ry, n. Developer's Metaphor

Blog

by Chris Paterra

For several years DotNetNuke has permitted module developer to extend the types of permissions applied at the module. For example, in the Forum module there was a need to permit “Global Moderators” and “Forum Administrators” as columns in the permissions grid you see when editing a module’s settings. By adding the permissions to the grid, module editors can assign permissions via Role or User just the same as they do when setting “Edit” permissions on the module (if extending it beyond the default admin edit permissions). As module developers, you can take advantage of this by adding more granular permissions to your module and utilizing the core security classes to handle the majority of work for you (ie. you do a check on the current user, similar to how you would check if the user was an admin). If you would like to review an example, you can download the Source version of the Forum module from CodePlex and check it out, or you can take a look at an article that describes it here. (NOTE: The link and the current Forum Source 4.5.3 are examples for DNN 3.x and 4.x ONLY!)

Previously, if I wanted to implement custom permissions in my module the only way to do this was to use IUpgradeable. Unfortunately, IUpgradeable had some problems in its past. In early implementations, there was no guarantee it would fire off and even in later versions (closer to 5.x) it seems that it still wouldn’t fire (on install) in some scenarios. With the release of DotNetNuke 5, custom permissions no longer need to be setup via IUpgradeable and instead you can use new nodes in the .dnn manifest file. If properly placed in the manifest file, the module installtion process will do all the work for you without requiring code or the use of IUpgradeable. An example of this can be seen below.

 

   1: </moduleControls>
   2:  <permissions>
   3:   <permission code="FORUM_MODULE" key="FORUMADMIN" name="Forum Administrator" />
   4:   <permission code="FORUM_MODULE" key="FORUMGLBMOD" name="Global Moderator" />
   5:  </permissions>
   6: </moduleDefinition>
   7: /moduleDefinitions>

 

TAGS:
DotNetNuke

Subscribe to this Blog

Contact Us!

AppTheory wants to talk to you about your business requirements. Click Contact Us below to fill out an online requirements questionnaire.

Contact Us

If you would like to contact us directly you can do so by calling Monday through Friday 9am to 6pm EST.