1: <?php
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: class Horde_Kolab_Server_Structure_Kolab extends Horde_Kolab_Server_Structure_Ldap
30: {
31: 32: 33: 34: 35:
36: public function getSupportedObjects()
37: {
38: return array(
39: 'Horde_Kolab_Server_Object',
40: 'Horde_Kolab_Server_Object_Groupofnames',
41: 'Horde_Kolab_Server_Object_Person',
42: 'Horde_Kolab_Server_Object_Organizationalperson',
43: 'Horde_Kolab_Server_Object_Inetorgperson',
44: 'Horde_Kolab_Server_Object_Kolab',
45: 'Horde_Kolab_Server_Object_Kolabinetorgperson',
46: 'Horde_Kolab_Server_Object_Kolabgermanbankarrangement',
47: 'Horde_Kolab_Server_Object_Kolabpop3account',
48: 'Horde_Kolab_Server_Object_Kolabgroupofnames',
49: 'Horde_Kolab_Server_Object_Kolabsharedfolder',
50: 'Horde_Kolab_Server_Object_Kolab_Address',
51: 'Horde_Kolab_Server_Object_Kolab_Administrator',
52: 'Horde_Kolab_Server_Object_Kolab_Distlist',
53: 'Horde_Kolab_Server_Object_Kolab_Domainmaintainer',
54: 'Horde_Kolab_Server_Object_Kolab_Maintainer',
55: 'Horde_Kolab_Server_Object_Kolab_User',
56: );
57: }
58:
59: 60: 61: 62: 63:
64: public function getSearchOperations()
65: {
66: $searches = array(
67: 'Horde_Kolab_Server_Search_Operation_Guid',
68: 'Horde_Kolab_Server_Search_Operation_Attributes',
69: 'Horde_Kolab_Server_Search_Operation_Children',
70: 'Horde_Kolab_Server_Search_Operation_Guidforcn',
71: 'Horde_Kolab_Server_Search_Operation_Guidforkolabusers',
72: 'Horde_Kolab_Server_Search_Operation_Guidforuid',
73: 'Horde_Kolab_Server_Search_Operation_Guidformail',
74: 'Horde_Kolab_Server_Search_Operation_Guidforuidormail',
75: 'Horde_Kolab_Server_Search_Operation_Guidforalias',
76: 'Horde_Kolab_Server_Search_Operation_Guidformailoralias',
77: 'Horde_Kolab_Server_Search_Operation_Guidforuidormailoralias',
78: 'Horde_Kolab_Server_Search_Operation_Mailforuidormail',
79: 'Horde_Kolab_Server_Search_Operation_Addressesforuidormail',
80: 'Horde_Kolab_Server_Search_Operation_Groupsformember',
81: );
82: return $searches;
83: }
84:
85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95:
96: protected function _determineType($guid, array $ocs)
97: {
98:
99: if (!in_array('kolabinetorgperson', $ocs)) {
100:
101: if (in_array('kolabgroupofnames', $ocs)) {
102: return 'Horde_Kolab_Server_Object_Kolabgroupofnames';
103: }
104:
105: if (in_array('kolabexternalpop3account', $ocs)) {
106: return 'Horde_Kolab_Server_Object_Kolabpop3account';
107: }
108:
109: if (in_array('kolabsharedfolder', $ocs)) {
110: return 'Horde_Kolab_Server_Object_Kolabsharedfolder';
111: }
112: return parent::_determineType($guid, $ocs);
113: }
114:
115: $groups = $this->getComposite()->search->searchGroupsForMember($guid);
116: if (!empty($groups)) {
117: $base = $this->getComposite()->server->getBaseGuid();
118: if (in_array('cn=admin,cn=internal,' . $base, $groups)) {
119: return 'Horde_Kolab_Server_Object_Kolab_Administrator';
120: }
121: if (in_array('cn=maintainer,cn=internal,' . $base,
122: $groups)) {
123: return 'Horde_Kolab_Server_Object_Kolab_Maintainer';
124: }
125: if (in_array('cn=domain-maintainer,cn=internal,' . $base,
126: $groups)) {
127: return 'Horde_Kolab_Server_Object_Kolab_Domainmaintainer';
128: }
129: }
130:
131: if (strpos($guid, 'cn=external') !== false) {
132: return 'Horde_Kolab_Server_Object_Kolab_Address';
133: }
134:
135: return 'Horde_Kolab_Server_Object_Kolab_User';
136: }
137:
138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148:
149: public function generateServerGuid($type, $id, array $info)
150: {
151: switch ($type) {
152: case 'Horde_Kolab_Server_Object_Kolab_User':
153: if (empty($info['user_type'])) {
154: return parent::generateServerGuid($type, $id, $info);
155: } else if ($info['user_type'] == Horde_Kolab_Server_Object_Kolab_User::USERTYPE_INTERNAL) {
156: return parent::generateServerGuid($type,
157: sprintf('%s,cn=internal', $id),
158: $info);
159: } else if ($info['user_type'] == Horde_Kolab_Server_Object_Kolab_User::USERTYPE_GROUP) {
160: return parent::generateServerGuid($type,
161: sprintf('%s,cn=groups', $id),
162: $info);
163: } else if ($info['user_type'] == Horde_Kolab_Server_Object_Kolab_User::USERTYPE_RESOURCE) {
164: return parent::generateServerGuid($type,
165: sprintf('%s,cn=resources', $id),
166: $info);
167: } else {
168: return parent::generateServerGuid($type, $id, $info);
169: }
170: case 'Horde_Kolab_Server_Object_Kolab_Address':
171: return parent::generateServerGuid($type,
172: sprintf('%s,cn=external', $id),
173: $info);
174: case 'Horde_Kolab_Server_Object_Kolabgroupofnames':
175: case 'Horde_Kolab_Server_Object_Kolab_Distlist':
176: if (!isset($info['visible']) || !empty($info['visible'])) {
177: return parent::generateServerGuid($type, $id, $info);
178: } else {
179: return parent::generateServerGuid($type,
180: sprintf('%s,cn=internal', $id),
181: $info);
182: }
183: case 'Horde_Kolab_Server_Object_Kolabsharedfolder':
184: case 'Horde_Kolab_Server_Object_Kolab_Administrator':
185: case 'Horde_Kolab_Server_Object_Kolab_Maintainer':
186: case 'Horde_Kolab_Server_Object_Kolab_Domainmaintainer':
187: default:
188: return parent::generateServerGuid($type, $id, $info);
189: }
190: }
191: }
192: