xref: /dokuwiki/lib/plugins/acl/remote.php (revision ab6ac843b05c4030087d58182c1bcea3dcc4e0af)
1<?php
2
3/**
4 * Class remote_plugin_acl
5 */
6class remote_plugin_acl extends DokuWiki_Remote_Plugin {
7
8    /**
9     * Returns details about the remote plugin methods
10     *
11     * @return array
12     */
13    public function _getMethods() {
14        return array(
15            'addAcl' => array(
16                'args' => array('string','string','int'),
17                'return' => 'int',
18                'name' => 'addAcl',
19                'doc' => 'Adds a new ACL rule.'
20            ), 'delAcl' => array(
21                'args' => array('string','string'),
22                'return' => 'int',
23                'name' => 'delAcl',
24                'doc' => 'Delete an existing ACL rule.'
25            ),
26        );
27    }
28
29    /**
30     * Add a new entry to ACL config
31     *
32     * @param string $scope
33     * @param string $user
34     * @param int    $level see also inc/auth.php
35     * @return bool
36     */
37    public function addAcl($scope, $user, $level){
38        /** @var admin_plugin_acl $apa */
39        $apa = plugin_load('admin', 'acl');
40        return $apa->_acl_add($scope, $user, $level);
41    }
42
43    /**
44     * Remove an entry from ACL config
45     *
46     * @param string $scope
47     * @param string $user
48     * @return bool
49     */
50    public function delAcl($scope, $user){
51        /** @var admin_plugin_acl $apa */
52        $apa = plugin_load('admin', 'acl');
53        return $apa->_acl_del($scope, $user);
54    }
55}
56
57