xoops forums

luciorota

Module Developer
Posted on: 4/11 19:47
luciorota
luciorota (Show more)
Module Developer
Posts: 192
Since: 2007/4/20
#1

Module permissions

Hi fellas!
Do you know if has anyone tried to move the definition of permissions in the 'xoops_version.php' file?

example
/ ------------------- Perms ------------------- //
$i 0;

$modversion['gperm'] = array();

$modversion['gperm'][] = [
    
'name' => 'itemR',
    
'title' => '_MI_PERM_ITEMR',
    
'description' => '_MI_PERM_ITEMR_DESC',
    
'itemid' => true,
    
'trueifadmin' => true,
    
'category' => ''
];
$modversion['gperm'][] = [
    
'name' => 'itemW',
    
'title' => '_MI_PERM_ITEMW',
    
'description' => '_MI_PERM_ITEMW_DESC',
    
'itemid' => true,
    
'trueifadmin' => true,
    
'category' => ''
];
$modversion['gperm'][] = [
    
'name' => 'itemRW',
    
'title' => '_MI_PERM_ITEMrW',
    
'description' => '_MI_PERM_ITEMRW_DESC',
    
'itemid' => true,
    
'trueifadmin' => true,
    
'category' => ''
];
$modversion['gperm'][] = [
    
'name' => 'print',
    
'title' => '_MI_PERM_PRINT',
    
'description' => '_MI_PERM_PRINT_DESC',
    
'itemid' => false,
    
'trueifadmin' => true,
    
'category' => ''
];

Mamba

Moderator
Posted on: 4/12 8:48
Mamba
Mamba (Show more)
Moderator
Posts: 10750
Since: 2004/4/23
#2

Re: Module permissions

I'm not aware of anybody trying that....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

geekwright

Quite a regular
Posted on: 4/12 21:04
geekwright
geekwright (Show more)
Quite a regular
Posts: 262
Since: 2010/10/15
#3

Re: Module permissions

Quote:

luciorota wrote:
Hi fellas!
Do you know if has anyone tried to move the definition of permissions in the 'xoops_version.php' file?...
Interesting. My first thought was driving an automated permissions page, similar to the about page:
$moduleAdmin->displayPermissions();


I would like to hear more about what you were thinking.

Mamba

Moderator
Posted on: 4/13 5:18
Mamba
Mamba (Show more)
Moderator
Posts: 10750
Since: 2004/4/23
#4

Re: Module permissions

Actually, Goffy has included permissions as part of the "sample data" in wgGallery, i.e. when the user imports the "sample data", the module permissions will be included automatically:
https://github.com/ggoffy/wggallery/co ... f59fe50c3c174a4ad320a5cdf

One of the items on my wish list was to have an easy solution for backing up data and all module preferences and permissions, and be able to upload them as needed, which would then make it easier to move the whole module between websites because you could keep your original settings and your data.

I've done it now for the "sample data", i.e. I can save my current module data as a "sample data" and then let the other users to simply import it. That helps me and other users to test modules, as we can make sure that we're using the same data and we can replicate any potential issues.

Now that Goffy added the "read" routine for permissions, we'll need to write a routine to save the current permissions, and then we can easily transfer modules between XOOPS installations, without having to deal with the database directly...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

luciorota

Module Developer
Posted on: 4/13 14:18
luciorota
luciorota (Show more)
Module Developer
Posts: 192
Since: 2007/4/20
#5

Re: Module permissions

Quote:

...driving an automated permissions page, similar to the about page


That's exactly what I'm looking for!

2 or more kind of permissions:
- "global permissions" for example: print, user extendee editor, ...
- "per item permissions" for example: read or write into a category, ...
- ...