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

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListGetPortalSettings? I dont get it...GetPortalSettings? I dont get it...
Previous
 
Next
New Post
6/19/2008 6:01 PM
 

I'm looking into putting custom permissions into my module and was researching the UDT's module security page in the source. In it they have what looks like a method or something named GetPortalSettings.

hasGeneralEditPermissions = PortalSecurity.IsInRole(GetPortalSettings.AdministratorRoleName) _
Or PortalSecurity.HasEditPermissions(moduleId)

I dont understand. I can find no references to this in the module source or on the web. Shouldn't GetPortalSettings.AdministratorRoleName be PortalSettings.AdministratorRoleName? When I try to experiment with this stuff It cant find reference to GetPortalSettings and when I do the norm and use PortalSettings, I get "An object reference is required......"

I'm still pretty new at .Net and DNN and I'm trying to learn VB and C# at the same time. Any help?

 
New Post
6/20/2008 8:59 AM
 

PortalSettings is a class type and AdministratorRoleName is a property of it. You will need an instance of PortalSettings to access that property. Modules inherit from PortalModulbase, which has a Property PortalSettings of type PortalSettings, and this property is set when the module gets injected.

The code you are showing resides in its own class ModuleSecurity. ModuleSecurity  is not aware of the current context, it has no property or field PortalSettings. Luckily the DNN framework offers some libraries to support the developper. DotNetNuke.Common.Globals is a vb.module that contains a public function GetPortalSettings(), which returns an instance of the current PortalSettings.

Hint: make a right click on unknown objects inside Visual Studio and choose "Go to Definition".

 
New Post
6/20/2008 9:28 AM
 

Ok. I think I understand that, but what is the GetPortalSettings used in ModuleSecurity? Where is it referenced at? Its being used several times when looking for the AdministratorRoleName but I don't see it created anywhere.

I'm sorry I'm still a bit confused.

 
New Post
6/22/2008 6:19 AM
 

VB allows to be lazy: GetPortalSettings.AdminstratorRoleName is the same as GetPortalSettings().AdministratorRoleName is the same as 
DotNetNuke.Common.Globals.GetPortalSettings().AdministratorRoleName .

As Globals is a VB module, it extends the set of available function and procedures. C# doesn't have a similar concept, you can not write this kind of libraries in C#. 

 
New Post
1/9/2010 6:07 AM
 

GetPortalSettings :

A means of getting PortalSettings in C# is as follows.

<%@ Import Namespace='DotNetNuke.Entities.Portals' %>
<%@ Import Namespace='DotNetNuke.Entities.Modules' %>
 

PortalModuleBase FindPortalModuleBase( Control cc)
{
 if( cc == null) return null;
 if( cc is PortalModuleBase) return( PortalModuleBase)cc;
 return FindPortalModuleBase( cc.Parent);
}

 PortalModuleBase pmb = FindPortalModuleBase( this);
 PortalSettings thesePortalSettings = pmb.PortalSettings;
 

JC

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListGetPortalSettings? I dont get it...GetPortalSettings? I dont get it...


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