Actions

GetGlobalBasePermissions: Difference between revisions

From LimeSurvey Manual

No edit summary
(Undo revision 135318 by DenisChenu (talk))
Tag: Undo
 
Line 9: Line 9:
'''Possible output'''
'''Possible output'''


* functions : array of new function for expression manager
* globalBasePermissions : array for each new Permission
* packages : array of javascript package to be registred
<pre>
    'permissionName' =>[
      'create'      : boolean (optionnal)
      'read'        : boolean (optionnal)
      'update'      : boolean (optionnal)
      'delete'      : boolean (optionnal)
      'import'      : boolean (optionnal)
      'export'      : boolean (optionnal)
      'title'      : string, translated title/name
      'description' : string, translated description
      'img'        : string,icon name class
    ]
</pre>


Best is to use


'''Example'''
'''Example'''


* LimeSurvey Demo plugin : https://github.com/LimeSurvey/LimeSurvey/tree/develop/plugins/Demo/demoAddEmFunction
* LimeSurvey core AuthWebServer plugin : https://github.com/LimeSurvey/LimeSurvey/blob/646e8bc3f13904b25f2692a135efdf9b2e013ed9/application/core/plugins/Authwebserver/Authwebserver.php#L40
<syntaxhighlight lang="php">
    public function getGlobalBasePermissions() {
        $this->getEvent()->append('globalBasePermissions',array(
            'auth_webserver' => array(
                'create' => false,
                'update' => false,
                'delete' => false,
                'import' => false,
                'export' => false,
                'title' => gT("Use web server authentication"),
                'description' => gT("Use web server authentication"),
                'img' => 'usergroup'
            ),
        ));
    }
</syntaxhighlight>


[[Category:Plugins events]]
[[Category:Plugins events]]

Latest revision as of 18:20, 13 February 2019

When

This event is fired before show the survey menu bar

Input

None

Possible output

  • globalBasePermissions : array for each new Permission
    'permissionName' =>[
      'create'      : boolean (optionnal)
      'read'        : boolean (optionnal)
      'update'      : boolean (optionnal)
      'delete'      : boolean (optionnal)
      'import'      : boolean (optionnal)
      'export'      : boolean (optionnal)
      'title'       : string, translated title/name
      'description' : string, translated description
      'img'         : string,icon name class
    ]

Best is to use

Example

    public function getGlobalBasePermissions() {
        $this->getEvent()->append('globalBasePermissions',array(
            'auth_webserver' => array(
                'create' => false,
                'update' => false,
                'delete' => false,
                'import' => false,
                'export' => false,
                'title' => gT("Use web server authentication"),
                'description' => gT("Use web server authentication"),
                'img' => 'usergroup'
            ),
        ));
    }