1: <?php
2: /**
3: * The backend for Kolab resources.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_FreeBusy
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=Kolab_FreeBusy
12: */
13:
14: /**
15: * The backend for Kolab resources.
16: *
17: * Copyright 2004-2008 Klarälvdalens Datakonsult AB
18: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
19: *
20: * See the enclosed file COPYING for license information (LGPL). If you did not
21: * receive this file, see
22: * http://www.horde.org/licenses/lgpl21.
23: *
24: * @category Kolab
25: * @package Kolab_FreeBusy
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
28: * @link http://pear.horde.org/index.php?package=Kolab_FreeBusy
29: */
30: class Horde_Kolab_FreeBusy_Resource_Kolab
31: implements Horde_Kolab_FreeBusy_Resource
32: {
33: /**
34: * The link to the folder.
35: *
36: * @var Horde_Kolab_Storage_Folder
37: */
38: private $_folder;
39:
40: /**
41: * The folder owner.
42: *
43: * @var Horde_Kolab_FreeBusy_Owner_Freebusy
44: */
45: protected $_owner;
46:
47: /**
48: * Constructor.
49: *
50: * @param Horde_Kolab_Storage_Folder $folder The storage folder
51: * representing this
52: * resource.
53: * @param Horde_Kolab_FreeBusy_Owner_Freebusy $owner The resource owner.
54: */
55: public function __construct(
56: Horde_Kolab_Storage_Folder $folder,
57: Horde_Kolab_FreeBusy_Owner $owner
58: ) {
59: $this->_folder = $folder;
60: $this->_owner = $owner;
61: }
62:
63: /**
64: * Return the owner of the resource.
65: *
66: * @return Horde_Kolab_FreeBusy_Owner The resource owner.
67: */
68: public function getOwner()
69: {
70: return $this->_owner;
71: }
72:
73: /**
74: * Return the name of the resource.
75: *
76: * @return string The name for the resource.
77: */
78: public function getName()
79: {
80: return $this->_folder->getName();
81: }
82:
83: /**
84: * Return the folder represented by this resource.
85: *
86: * @return Horde_Kolab_Storage_Folder The folder.
87: */
88: protected function getFolder()
89: {
90: return $this->_folder;
91: }
92:
93: /**
94: * Return the data represented by this resource.
95: *
96: * @return Horde_Kolab_Storage_Data The data.
97: */
98: protected function getData()
99: {
100: return $this->_folder->getData();
101: }
102:
103: /**
104: * Return for whom this resource exports relevant data.
105: *
106: * @return string The user type the exported data of this resource is
107: * relevant for.
108: *
109: * @throws Horde_Kolab_FreeBusy_Exception If retrieving the relevance
110: * information failed.
111: *
112: * @todo It would be nice if we would not only have the free/busy specific
113: * relevance but a generic way of setting the relevance of resources.
114: */
115: public function getRelevance()
116: {
117: throw new Horde_Kolab_FreeBusy_Exception(
118: 'There is no generic definition for relevance available!'
119: );
120: }
121:
122: /**
123: * Fetch the resource ACL.
124: *
125: * @return array ACL for this resource.
126: *
127: * @throws Horde_Kolab_FreeBusy_Exception If retrieving the ACL information
128: * failed.
129: */
130: public function getAcl()
131: {
132: $perm = $this->_folder->getPermission();
133: $acl = &$perm->acl;
134: return $acl;
135: }
136:
137: /**
138: * Fetch the access controls on specific attributes of this
139: * resource.
140: *
141: * @return array Attribute ACL for this resource.
142: *
143: * @throws Horde_Kolab_FreeBusy_Exception If retrieving the attribute ACL
144: * information failed.
145: *
146: * @todo It would be nice if we would not only have the free/busy specific
147: * attribute acls but a generic way of setting attribute ACL for resources.
148: */
149: public function getAttributeAcl()
150: {
151: throw new Horde_Kolab_FreeBusy_Exception(
152: 'There is no generic definition for attribute ACL available!'
153: );
154: }
155: }
156: