[Cartoweb-users] Auth like in edit plugin

Jacolin Yves yjacolin at free.fr
Fri Jun 16 04:49:22 EDT 2006


Hello,
After creating my plugin, I would like to allow only users who have accessing 
to the edit plugin. So I try several things :
1- I tried to include my templates in the edit template (my template is send 
by renderForm and is called $layersManager)
2- I tried to include it in cartoclient.tpl and add {if $edit_allowed|
default:''}{/if}
3- I tried to use auth like in edit plugin and copy past some code :
function getArrayFromIni, getArrayFromList
And modify my renderForm function :
/**************************************************
// authentification
        $editRoles = $this->getArrayFromIni('general.allowedRoles', true);
        $allowed = SecurityManager::getInstance()->hasRole($editRoles);
        $template->assign(array('edit_active' => true,
                                'manager_allowed' => $allowed,
                                'layersManagerMessage'=>$this->Message));
***************************************************/
Actually I add a parameter in my layersManager.ini file : general.allowedRoles 
to allow or not people to access to this plugin even if they can (or not) 
access to the edit plugin. It is not really a good thing but I want to test 
first, I will improve this later.

My question : why none of this test doesn't work ? Well I know why for the 2 
firts one, not for the last. Any idea ? Thanks you for your help.

Y.
-- 
Yves Jacolin
http://yjacolin.gloobe.org
----
Stagaire Conservatoire Régional des Espaces Naturels de la région Centre
http://cahiersnaturalistes.free.fr/cpnrc/
----
- Qu'est-ce que cela peut faire que je lutte pour la mauvaise cause 
puisque je suis de bonne foi?
- Et qu'est-ce que ça peut faire que je sois de mauvaise foi
puisque c'est pour la bonne cause. (Jacques Prévert)



More information about the Cartoweb-users mailing list