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.0Custom permissionCustom permission
Previous
 
Next
New Post
7/4/2007 5:08 AM
 

For my module i created a custom permission:

 

 

 

 

 

 

ModulePermissionCollection

mp = modInfo.ModulePermissions;

_PERMISSION =

 

ModulePermissionController

.HasModulePermission(mp, key);

}

 

 

public bool

CanScan

{

 

 

get { return

_PERMISSION; }

}

In my page i have this:

 

 

 

 

{

Actions.Add(

}

 

this.GetNextActionID(), "test", ModuleActionType.AddContent, "", "edit.gif", EditUrl("ViewP"), false, SecurityAccessLevel.Anonymous, true, false);return Actions;
ModuleSecurity ms = new ModuleSecurity(ModuleConfiguration);ModuleActionCollection Actions = new ModuleActionCollection();if (ms.CanScan)

 

 

 

 

 

 

This way i create a moduleaction item in the menu. The problem is now that the security level has to be set to anonymous to be shown. Sow if if you type the URL like ctl=ViewP you can acces the page when you are not logged in. How do i generate the same kind of error like with the default permissions? (Default behavior go to login page, or sow error when permissions are wrong)

 

public

ModuleSecurity(ModuleInfo modInfo)

{

 
New Post
7/4/2007 5:42 AM
 

sorry for the enters :) copy paste from VS has gone wrong it seems....

 
New Post
7/4/2007 8:49 AM
 

It would be simpler to create a role that is the permission you are after, and then during the module, you can check if the user has the role you want and then if so, show the module action and do whatever logic you want.  I'm not at a computer with any source code so unfortunately I can't give an example, but look in the DotNetNuke.Entities.UserController for a "userhasrole" or something like that... maybe even UserInfo.HasRole("") might be a valid option.


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
7/4/2007 9:17 AM
 

fooberichu wrote

It would be simpler to create a role that is the permission you are after, and then during the module, you can check if the user has the role you want and then if so, show the module action and do whatever logic you want.  I'm not at a computer with any source code so unfortunately I can't give an example, but look in the DotNetNuke.Entities.UserController for a "userhasrole" or something like that... maybe even UserInfo.HasRole("") might be a valid option.

The problem is that all the controls are inside the same module defenition, within the module design i have 4 roles. The problem is that within the module definition you can only choose: view, admin, anonymous and host. Sow if i say that control x is an edit, and I need control y as edit to, with the difference that the role is not the same. I don't want control x to be edited by a role set to control y. That's why I created a custom permission so I can set wich role(s) I want to one specific role.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom permissionCustom permission


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