- Posts: 9
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
class myPerms extends AuthPluginBase { protected $storage = 'DbStorage'; static protected $description = 'A plugin to give specific Permissions'; static protected $name = 'myPerms'; public function beforeHasPermission() { static $aPermissionStatic; $oEvent = $this->getEvent(); $iEntityID = $oEvent->get('iEntityID'); $sEntityName = $oEvent->get('sEntityName'); $sPermission = $oEvent->get('sPermission'); $sCRUD = $oEvent->get('sCRUD'); $iUserID = $oEvent->get('iUserID'); $controller = null; $action = null; if(Permission::isForcedSuperAdmin($iUserID)) { // Forced superadmin: no uodate return; } if(empty($iUserID)) { $iUserID = Permission::getUserId(); } if($sPermission=='surveyactivation') { $oEvent->set('bPermission', false); } } }
if($sPermission !== 'responses' or $sPermission !== 'token') { $oEvent->set('bPermission', false); }