-
Notifications
You must be signed in to change notification settings - Fork 5
/
Acl.php
78 lines (74 loc) · 1.91 KB
/
Acl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Maps a single Kolab_Storage ACL element to the Horde permission system.
*
* PHP version 5
*
* @category Horde
* @package Perms
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
*/
/**
* Maps a single Kolab_Storage ACL element to the Horde permission system.
*
* Copyright 2006-2017 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @package Perms
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
*/
abstract class Horde_Perms_Permission_Kolab_Acl
{
/**
* The ACL.
*
* @var string
*/
private $_acl;
/**
* Constructor.
*
* @param string $acl The folder ACL element as provided by the driver.
*/
public function __construct($acl)
{
$this->_acl = $acl;
}
/**
* Convert the Acl string to a Horde_Perms:: mask and store it in the
* provided data array.
*
* @param array &$data The horde permission data.
*
* @return NULL
*/
abstract public function toHorde(array &$data);
/**
* Convert the Acl string to a Horde_Perms:: mask.
*
* @return int The permission mask
*/
protected function convertAclToMask()
{
$result = 0;
if (strpos($this->_acl, 'l') !== false) {
$result |= Horde_Perms::SHOW;
}
if (strpos($this->_acl, 'r') !== false) {
$result |= Horde_Perms::READ;
}
if (strpos($this->_acl, 'i') !== false) {
$result |= Horde_Perms::EDIT;
}
if (strpos($this->_acl, 'd') !== false ||
strpos($this->_acl, 't') !== false) {
$result |= Horde_Perms::DELETE;
}
return $result;
}
}