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...DNN Platform (o...DNN Platform (o...SecurityAccessLevel interpretation in DNN5.2SecurityAccessLevel interpretation in DNN5.2
Previous
 
Next
New Post
4/14/2010 12:39 PM
 

Hi,

I have a custom module that adds items to an action module using the IActionable interface. Relevant code excerpt below. I want one user role (Administrator) to be able to access all the menu options, and another role, which has Edit access to the module, only to be able to access one option.

I thought that by setting the Security argument to SecurityAccessLevel.Edit for the option available to both roles, and SecurityAccessLevel.Admin for the Admin only role, I'd get what I wanted. However, it seems that the two values give the same access right to both roles.

Is there a difference between the SecurityAccessLevel.Admin and SecurityAccessLevel.Edit values in DNN5.2, or has the distinction been removed along with the changes to Admin modules? Is there any other way I can achieve what I want to do here?

        public ModuleActionCollection ModuleActions
        {
            get
            {
                ModuleActionCollection Actions = new ModuleActionCollection();
                Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.EditContent, this.LocalResourceFile),
                   ModuleActionType.AddContent, string.Empty, string.Empty, EditUrl(), false, DotNetNuke.Security.SecurityAccessLevel.Edit,
                    true, false);
                Actions.Add(GetNextActionID(), Localization.GetString(LocalModuleActionType.EditClient, this.LocalResourceFile),
                   LocalModuleActionType.EditClient, string.Empty, "edit.gif", EditUrl("Clients"), false, DotNetNuke.Security.SecurityAccessLevel.Admin,
                    true, false);
                Actions.Add(GetNextActionID(), Localization.GetString(LocalModuleActionType.EditService, this.LocalResourceFile),
                   LocalModuleActionType.EditService, string.Empty, "edit.gif", EditUrl("Services"), false, DotNetNuke.Security.SecurityAccessLevel.Admin,
                    true, false);
                return Actions;
            }
        }
 



Paul Taylor
Dotcom Software Solutions Ltd
DotNetNuke, ASP.NET and SQL Server Development
 
New Post
4/14/2010 12:43 PM
 

 I don't know about the SecurityAccessLevel settings. I just use edit because I never noticed a difference.

To do what you want you can wrap the actions.Add in if(IsEditable) and If(UserInfo.IsInRole(PortalSettings.AdministratorRoleName))

 
New Post
4/14/2010 1:13 PM
 

Thanks, works great.



Paul Taylor
Dotcom Software Solutions Ltd
DotNetNuke, ASP.NET and SQL Server Development
 
New Post
4/16/2010 12:56 PM
 

To clarify:

The SecurityAccessLevel settings should mean:

  • View - must have View permissions
  • Edit - must have Edit permissions
  • Admin - must be an Administrator
  • Host - must be a super user

Hope this helps

 


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
4/20/2010 5:12 AM
 

Thanks for the reply Charles.

Testing it again, I see that it works exactly like that. I discovered I had given the editor role page editor permissions before, thereby giving it administrative rights in page modules. When I removed page editor rights and granted module editor rights to the role, it worked they way I wanted.



Paul Taylor
Dotcom Software Solutions Ltd
DotNetNuke, ASP.NET and SQL Server Development
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...SecurityAccessLevel interpretation in DNN5.2SecurityAccessLevel interpretation in DNN5.2


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