Overview

Packages

  • Perms

Classes

  • Horde_Perms
  • Horde_Perms_Base
  • Horde_Perms_Datatree
  • Horde_Perms_Exception
  • Horde_Perms_Null
  • Horde_Perms_Permission
  • Horde_Perms_Permission_Datatree
  • Horde_Perms_Permission_Kolab
  • Horde_Perms_Permission_Kolab_Acl
  • Horde_Perms_Permission_Kolab_Acl_Anonymous
  • Horde_Perms_Permission_Kolab_Acl_Anyone
  • Horde_Perms_Permission_Kolab_Acl_Creator
  • Horde_Perms_Permission_Kolab_Acl_Group
  • Horde_Perms_Permission_Kolab_Acl_User
  • Horde_Perms_Permission_Kolab_AclIterator
  • Horde_Perms_Permission_Kolab_Element
  • Horde_Perms_Permission_Kolab_Element_Creator
  • Horde_Perms_Permission_Kolab_Element_Default
  • Horde_Perms_Permission_Kolab_Element_Group
  • Horde_Perms_Permission_Kolab_Element_Guest
  • Horde_Perms_Permission_Kolab_Element_User
  • Horde_Perms_Permission_Kolab_ElementIterator
  • Horde_Perms_Permission_Sql
  • Horde_Perms_Sql
  • Horde_Perms_Translation

Interfaces

  • Horde_Perms_Permission_Kolab_Storage
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Maps a single Horde permission element to a Kolab_Storage ACL.
 4:  *
 5:  * PHP version 5
 6:  *
 7:  * @category Horde
 8:  * @package  Perms
 9:  * @author   Gunnar Wrobel <wrobel@pardus.de>
10:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
11:  * @link     http://pear.horde.org/index.php?package=Perms
12:  */
13: 
14: /**
15:  * Maps a single Horde permission element to a Kolab_Storage ACL.
16:  *
17:  * Copyright 2006-2012 Horde LLC (http://www.horde.org/)
18:  *
19:  * See the enclosed file COPYING for license information (LGPL). If you
20:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21:  *
22:  * @category Horde
23:  * @package  Perms
24:  * @author   Gunnar Wrobel <wrobel@pardus.de>
25:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
26:  * @link     http://pear.horde.org/index.php?package=Perms
27:  */
28: abstract class Horde_Perms_Permission_Kolab_Element
29: {
30:     /**
31:      * The permission.
32:      *
33:      * @var int
34:      */
35:     private $_permission;
36: 
37:     /**
38:      * Constructor.
39:      *
40:      * @param int $permission The folder permission as provided by Horde.
41:      */
42:     public function __construct($permission)
43:     {
44:         $this->_permission = $permission;
45:     }
46: 
47:     /**
48:      * Convert the Horde_Perms:: mask to a Acl string.
49:      *
50:      * @return string The ACL string.
51:      */
52:     public function fromHorde()
53:     {
54:         return $this->convertMaskToAcl();
55:     }
56: 
57:     /**
58:      * Get the Kolab_Storage ACL id for this permission.
59:      *
60:      * @return string The ACL string.
61:      */
62:     abstract public function getId();
63: 
64:     /**
65:      * Unset the element in the provided permission array.
66:      *
67:      * @param array &$current The current permission array.
68:      *
69:      * @return NULL
70:      */
71:     abstract public function unsetInCurrent(&$current);
72: 
73:     /**
74:      * Convert the a Horde_Perms:: mask to a Acl string.
75:      *
76:      * @return string The ACL
77:      */
78:     protected function convertMaskToAcl()
79:     {
80:         $result = '';
81:         if ($this->_permission & Horde_Perms::SHOW) {
82:             $result .= 'l';
83:         }
84:         if ($this->_permission & Horde_Perms::READ) {
85:             $result .= 'r';
86:         }
87:         if ($this->_permission & Horde_Perms::EDIT) {
88:             $result .= 'iswc';
89:         }
90:         if ($this->_permission & Horde_Perms::DELETE) {
91:             $result .= 'd';
92:         }
93: 
94:         return $result;
95:     }
96: }
97: 
API documentation generated by ApiGen