Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesCustom Module PermissionsCustom Module Permissions
Previous
 
Next
New Post
9/29/2012 3:28 PM
 

Hello,

I am developing a custom module for DNN.

I am working with DNN Community Edition 06.02.02
I am working with Manifest version 5.0

<dotnetnuke type="Package" version="5.0">

In version 02.00.00 of my custom module, I have added Custom Module Permissions by adding the following into my manifest file for a certain module definition:

<permissions>
      <permission code="MY_MODULE" key="EDIT" name="Edit Stuff" />
</permissions>


Now I am developing version 03.00.00 - and I need to remove this permission completely from my module since now it is causing problems.

My question is simple: How to I remove it automatically using the manifest for version 03.00.00 of my module?
Just removing it from the manifest file would do it?

I have already thought of writing a SQL Script that will update the Permission/ModulePermission tables, but I am wondering if there is a better way of doing it directly from the manifest.

Please let me know.

Thanks,
Simcha

 
New Post
9/29/2012 8:00 PM
 

Unfortunately the module installer does not provide any way by means of the dnn manifest to remove a previously defined custom permission during upgrade. As far as I know (but have not tested), simply omitting the custom permission from the manifest will not remove the permission.

Although you could remove the permission by directly manipulating the core Permission table in your upgrade version's SqlDataProvider script, I recommend against this approach. There is no assurance that the structure of any core table will remain the same from version to version. Backward compatibility through the use of publicly exposed DNN API methods is, however, closely adhered to from version to version.

I would implement in your v 3 module's business controller class the IUpgradable interface and in that implementation use the DotNetNuke.Security.Permissions.PermissionController class's

public void DeletePermission (int permissionID)

method to delete the custom permission from the core Permission table. Because foreign key relationships with cascade delete enabled exist between both the ModulePermission and DestopModulePermission tables and the Permission table, simply deleting the custom permission from the Permission table should remove all references to it from the ModulePermission and DesktopModulePermission table.

Before calling DeletePermission you will need to obtain the permissionID of the custom permission. This can be done by using the PermissionController's

public ArrayList GetPermissionByCodeAndKey(string permissionCode, string permissionKey)

to obtain a PermissionInfo object which will contain the PermissionID.

Here's a link to an article that explains how to define custom permissions in code using an IUpgradable implementation during installation of a module. Prior to enhancements of the module installer to allow specification of custom permissions in the manifest, that was the recommended way to create custom permissions.

http://www.codeproject.com/Articles/3...


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesCustom Module PermissionsCustom Module Permissions


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out