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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to add more permission into my module How to add more permission into my module
Previous
 
Next
New Post
3/3/2008 4:42 PM
 

Sorry, my mistake. Just trying to help.


Dwayne J. Baldwin
 
New Post
3/3/2008 8:24 PM
 

Hi William, your post might very helpful. I will give it a try.

Thanks so much.

 
New Post
3/4/2008 12:35 AM
 

I have tried it.

  • Have you set a break point in the code to see if it is getting hit when the module is installed?  No, i set break point in UpgradeModule but not work
  • Am I correct that the UpgradeModule method is located in your BusinessClassController and the name of the controller class properly referenced in your .dnn manifest file? Yes, I did that
  • Have you checked that following installation of the module, the module definition is showing Upgradable as one of its Supported Features. Do you have at least one xx.xx.xxSqlDataProvider file included in the install package and referenced in the .dnn manifest? I have xxx.xxx.xxx.SqlDataProvider but i can't check in Upgradeable checkbox when i install module. All of checkbox ISearchable, IPortable, IUpgradeable are disable so i can't check in.
  • Since the UpgradeModule method is not directly called from the installation code but rather by an event which has been placed in the EventQueue table and run when the application restarts immediately following the install, you should be able to look at this table to see if the event was created and that it actually ran to completion. The event would have "UpgradeModule" in the ProcessorCommand column and infomation about the BusinessClassController name, DesktopModuleID, etc. in the Attributes column.  If the event was successfully run the IsCompleted column should be True. I have check data in DesktopModule table, it has infomation about BussinessClassController, DesktopModuleID ....  But Permission table and EventQueue table have no infomation as you said
So, i will post my code later. Base on your code in VB, i convert it into C# and make one ControllerClass to test. But It still doesn't work.  Please show me where I was wrong.

Thanks & Regards.

 
New Post
3/4/2008 1:36 AM
 

Hi William,

There is my code. Base on your Code. I only covert from VB to C#. I don't know why you can do it in vb but i can't do it in C#

1.Controller

using System;
using System.Data;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Definitions;
using DotNetNuke.Security.Permissions;
using System.Collections;

namespace EPortal.Partner.Components
{
    public class PartnerController : IUpgradeable
    {
        public string UpgradeModule(string Version)
        {
            string strResult;
            DesktopModuleController dmc = new DesktopModuleController();
            DesktopModuleInfo dmi = dmc.GetDesktopModuleByModuleName("EPortal.Partner");
            if (dmi == null)
            {
                strResult = Version + " - failure to obtain DesktopModuleInfo object for ModuleName EPortal.Partner";
            }
            else
            {
                try
                {
                    ModuleDefinitionController mdc = new ModuleDefinitionController();
                    ModuleDefinitionInfo mdi = mdc.GetModuleDefinitionByName(dmi.DesktopModuleID, dmi.FriendlyName);
                    int ModuleDefID = mdi.ModuleDefID;
                    PermissionController pc = new PermissionController();
                    ArrayList ModulePermissions = pc.GetPermissionsByModuleDefID(ModuleDefID);
                    bool Management = false;
                    foreach (PermissionInfo pi in ModulePermissions)
                    {
                        if ((pi.PermissionCode == "PARTNER") && (pi.PermissionKey == "MANAGE"))
                        {
                            Management = true;             
                        }
                    }
                    if (!Management )
                    {
                        PermissionInfo pi = new PermissionInfo();
                        pi.ModuleDefID = ModuleDefID;
                        pi.PermissionCode = "PARTNER";
                        pi.PermissionKey = "MANAGE";
                        pi.PermissionName = "Can Management";
                        pc.AddPermission(pi);
                    }
                    strResult = Version + " - PARTNER permissions MANAGE successfully added";
                }
                catch (Exception e)
                {
                    strResult = Version + " - Error in adding PARTNER permissions: " + e.Message;
                    throw;
                }
            }
            return strResult;
        }
    }
}

2. DNN manifest

<dotnetnuke version="3.0" type="Module">
  <folders>
    <folder>
      <name>EPortal.Partner</name>
      <friendlyname>EPortal.Partner</friendlyname>
      <foldername>EPortal.Partner</foldername>
      <modulename>EPortal.Partner</modulename>
      <description>A EPortal Partner module</description>
      <version>01.00.00</version>
      <businesscontrollerclass>EPortal.Partner.Components.PartnerController</businesscontrollerclass>
      <modules>
        <module>
          <friendlyname>EPortal.Partner</friendlyname>
          <cachetime>0</cachetime>
          <controls>
            <control>
              <src>DesktopModules/EPortal.Partner/List.ascx</src>
              <type>View</type>
              <helpurl></helpurl>
            </control>
            <control>
              <key>Editpartner</key>
              <title>Edit Content</title>
              <src>DesktopModules/EPortal.Partner/Edit.ascx</src>
              <type>Edit</type>
              <helpurl></helpurl>
            </control>
            <control>
              <key>AddPartnerType</key>
              <title>EPortal.Partner Settings</title>
              <src>DesktopModules/EPortal.Partner/ListPartnertype.ascx</src>
              <type>Edit</type>
              <helpurl></helpurl>
            </control>
          </controls>
        </module>
      </modules>
      <files>
        <file>
         <name>EPortal.Partner.dll</name>
    </file>
        <file>
          <name>List.ascx</name>
        </file>
        <file>
          <name>Edit.ascx</name>
        </file>
        <file>
          <name>ListPartnertype.ascx</name>
        </file>
        <file>
          <path>App_LocalResources</path>
          <name>List.ascx.resx</name>
        </file>

        <file>
          <path>App_LocalResources</path>
          <name>List.ascx.vi-VN.resx</name>
        </file>
       
        <file>
          <path>App_LocalResources</path>
          <name>Edit.ascx.resx</name>
        </file>
       
        <file>
          <path>App_LocalResources</path>
          <name>Edit.ascx.vi-VN.resx</name>
        </file>
        <file>
          <path>App_LocalResources</path>
          <name>ListPartnertype.ascx.resx</name>
        </file>
        <file>
          <path>App_LocalResources</path>
          <name>ListPartnertype.ascx.vi-VN.resx</name>
        </file>
        <file>
          <name>01.00.00.SqlDataProvider</name>
        </file>
        <file>
          <name>Uninstall.SqlDataProvider</name>
        </file>
      </files>
    </folder>
  </folders>
</dotnetnuke>

 

 
New Post
3/4/2008 9:58 AM
 

I don't see any problems in your UpgradeModule code nor in your .dnn manifest. It appears that the installer is not recognizing that the IUpgradable interface has been implemented in the controller class so your code never gets called. If it did you should see the result string being returned by UpgradeModule as the install runs and see that an event with ProcessCommand of UpgradeModule created in the EventQueue table. Here are a few more questions to help track down the problem:

1. When you are testing the install (on a test site - not your development site), are you first deleting any module definition from a previous install? Otherwise, the installer would see this as an upgrade to the same version and not create add the UpgradeModule even to the EvenQueue.

2. Have you verified that the full name of the business controller class is that shown in the manifest. Since this is a WAP (compiled) module. Check in your project's properties that the Root Namespace is blank. If it is not the actual name of the business controller class will also have to include the Root Namespace.

3. You mentioned that following an install the checkboxes in the Module Definition for the various supported features are disabled. That would be normal as these are automatically set. Am I correct that Upgradable is not checked? Have you implemented ISearchable or IPortable? If so, did either of the Searchable or Portable checkboxes for Supported Features get checked?

4. Have you checked the Event Viewer to see if any errors relating to the install or operation of the module are shown?

Hope one of these questions provides the answer - otherwise I'm stumped for now.


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
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to add more permission into my module How to add more permission into my module


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