[Cartoweb-users] editing

Oliver Christen oliver.christen at camptocamp.com
Wed Sep 27 08:52:08 EDT 2006


you will need to replace the edit plugin and add some check function where 
the list of layers for edition is generated (I think, this has not been done 
before as far as I know).

class ClientSpecialEdit extends ClientEdit implements GuiProvider{

     /**
     * Constructor
     */
    public function __construct() {
        $this->log =& LoggerManager::getLogger(__CLASS__);
        parent::__construct();
    }

    /**
     * @see PluginBase::replacePlugin()
     */
    public function replacePlugin() {
        return 'edit';
    }

    /**
     * @see GuiProvider::renderForm()
     */
    public function renderForm(Smarty $template) {

        /* copy all content from the ClientEdit.php and modify the
        lines generating the layers list according to your user roles*/

        // ... //

        // editable layers list
        $layersList =  $this->getConfig()->editLayers;
        /* this is problably what need to be changed, the rest can be the 
same, maybe */

        // ... //

    }

}


also at several place there are roles check :
$editRoles = $this->getArrayFromIni('general.allowedRoles', true);
$allowed = SecurityManager::getInstance()->hasRole($editRoles);
im not sure but i suppose these will have to be modified also, maybe by 
including some kind of general mechanism to handle multiple roles/users




> Hi,
>
> I want to set different roles for different editable layers. I mean I want 
> restrict edit access to layer based on role name.
> Example:
>
> Layer  (can be edited by)  Role
> --------------------------------
> sea                    |             sea_edit
> house                |             house_edit
>
>
> and so on..
>
> How can I set this in CartoWeb?
>
> Thank you
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list