Page 1 of 1

[SOLVED] Module permissions

Posted: Wed Apr 03, 2013 9:11 pm
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');
    }

Re: Module permissions

Posted: Thu Apr 04, 2013 8:03 am
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...