[Cartoweb-users] Auth like in edit plugin
Jacolin Yves
yjacolin at free.fr
Fri Jun 16 09:09:39 EDT 2006
Hello,
Sorry, I found where the code was not correct :-(
This is not correct :
/***********
> $template->assign(array('edit_active' => true,
> 'manager_allowed' => $allowed,
> 'layersManagerMessage'=>$this->Message));
/*************
and have to be replaced by :
/***********
> $template->assign(array('edit_active' => true,
> 'manager_allowed' => $allowed,
> 'layersManagerMessage'=>$this->Message));
/*************
$smarty = new Smarty_Plugin($this->getCartoclient(), $this);
$smarty->assign(array('manager_allowed' => $allowed,
'layersManagerMessage' => $this->Message));
$template->assign('layersManager', $smarty->fetch('layersManager.tpl'));
/************
Y.
Le Vendredi 16 Juin 2006 10:49, Jacolin Yves a écrit :
> 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