[SOLVED] Module permissions

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

[SOLVED] Module permissions

Post by nervino »

Hello, I can't correctly set the permissions for my module in order to create a user account that can manage it.

I created a new user (say "newuser") that belongs to "Editors group".
I set the permissions of the "Editors group", granting ALL the permissions (like admin group) including Mymodule's ones.

When I log in the administration panel as "newuser" and I try to use Mymodule, I have a blank page. If I log with the default admin account, all works fine.

I'm probably doing some mistakes setting up permissions for my module.
Can anyone give me a suggestion? (I hope not: "Keep your day job!" :) ).

Thank you


Using:
CMSMS 1.11.5
PHP 5.3.10
MySQL 5.5.29



In method.install.php, I have:

Code: Select all

<?php
if( !isset($gCms) ) exit;

#Set Permission
$this->CreatePermission('Modify Options mymodule', 'Modify Options mymodule');
$this->CreatePermission('Modify pref mymodule', 'Modify pref mymodule');
$this->CreatePermission('Use mymodule', 'Use mymodule');
?>

In MyModule.module.php:

Code: Select all

function VisibleToAdminUser()
    {
        return $this->CheckPermission('Modify Options mymodule') || 
	    $this->CheckPermission('Modify pref mymodule') || 
        $this->CheckPermission('Use mymodule');
    }
Last edited by nervino on Thu Apr 04, 2013 8:04 am, edited 1 time in total.
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Module permissions

Post by nervino »

I've found the cause. The issue was due to the wrong case of a letter in action.defaultadmin.php:
CheckPermission('Use Mymodule')
instead of
CheckPermission('Use mymodule')

Sorry...
Post Reply

Return to “Developers Discussion”