Commit 4a23eb1c authored by Denis Chenu's avatar Denis Chenu
Browse files

[feature] Add hasGlobalPermission + hasSurveyPermission function

parent a267089a
......@@ -39,4 +39,41 @@ class RemoteControlHandler extends remotecontrol_handle
}
}
}
/**
* RPC Routine to get global permission of the actual user
*
* @access public
* @param string $sSessionKey Auth credentials
* @param string $sPermission string Name of the permission - see function getGlobalPermissions
* @param $sCRUD string The permission detailsyou want to check on: 'create','read','update','delete','import' or 'export'
* @return bool True if user has the permission
* @return boolean
*/
public function hasGlobalPermission($sSessionKey,$sPermission,$sCRUD='read')
{
$this->_checkSessionKey($sSessionKey);
return array(
'permission'=>Permission::model()->hasGlobalPermission($sPermission,$sCRUD)
);
}
/**
* RPC Routine to get survey permission of the actual user
*
* @access public
* @param string $sSessionKey Auth credentials
* @param $iSurveyID integer The survey ID
* @param $sPermission string Name of the permission
* @param $sCRUD string The permission detail you want to check on: 'create','read','update','delete','import' or 'export'
* @return bool True if user has the permission
* @return boolean
*/
public function hasSurveyPermission($sSessionKey,$iSurveyID, $sPermission, $sCRUD='read')
{
$this->_checkSessionKey($sSessionKey);
return array(
'permission'=>\Permission::model()->hasSurveyPermission($iSurveyID, $sPermission, $sCRUD),
);
}
}
......@@ -5,7 +5,7 @@
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2015-2016 Denis Chenu <http://sondages.pro>
* @license GPL v3
* @version 1.0
* @version 1.1.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment