Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Custom module permissions problem View modes: 
User avatar
Member
Member
p.murray-rocksolid.com - 10/1/2013 8:10:41 PM
   
Custom module permissions problem
I’m having an issue with a custom module.

When logged in as global administrator, the Tools menu in CMS desk allows access to the module as expected.

However, for the non-global admin user in a role with 'read' permissions set for the specific module, access is denied with the UI returning the warning:
"Your UI profile is not granted with permission to access this section"

It appears the check "IsAuthorizedPerUIElement(CMS.Tools, ToolsDashboardElement)" in the codefile \CMSModules\Widgets\Controls\Dashboard.ascx.cs
is causing this access to fail and returning the warning (confirmed by removing the "IsAuthorizedPerUIElement" check shown below - after which access is allowed)
// Check UIProfile
if ((CMSContext.CurrentUser == null) || (!CMSContext.CurrentUser.IsAuthorizedPerUIElement(ResourceName, ElementName)))

{
URLHelper.Redirect(UIHelper.GetInformationUrl("uiprofile.uinotavailable"));
}

(Note - I believe this is the original Kentico code here, hasn't been modified from source).

Can anyone let me know how I can set the Authorization on the specific UI elements so this security check will work for the custom module?

User avatar
Member
Member
p.murray-rocksolid.com - 10/1/2013 8:30:40 PM
   
RE:Custom module permissions problem
Some further context if this helps ...

this is the code from the custom module referencing the ResourceName & ElementName mentioned in my previous post
  protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);

// Must be equal to the code name of the module containing the corresponding UI element
ucDashboard.ResourceName = "CMS.Tools";

// Must be equal to the code name of the corresponding UI element
ucDashboard.ElementName = "ToolsDashboardElement";

ucDashboard.PortalPageInstance = this as PortalPage;
ucDashboard.TagsLiteral = this.ltlTags;
ucDashboard.DashboardSiteName = CMSContext.CurrentSiteName;

ucDashboard.SetupDashboard();
}

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 10/2/2013 7:59:10 AM
   
RE:Custom module permissions problem
I'm pretty sure there is nothing wrong with the code. You might look into the CMSSiteManager>Administration>UI personalization. You can grant someone access all day long through the module but if you don't set the UI permissions by role, you will receive errors or unwanted results.