@@ -23,11 +23,11 @@ |
||
| 23 | 23 | |
| 24 | 24 | class PublicCalendarObject extends CalendarObject { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * public calendars are always shared |
|
| 28 | - * @return bool |
|
| 29 | - */ |
|
| 30 | - protected function isShared() { |
|
| 31 | - return true; |
|
| 32 | - } |
|
| 26 | + /** |
|
| 27 | + * public calendars are always shared |
|
| 28 | + * @return bool |
|
| 29 | + */ |
|
| 30 | + protected function isShared() { |
|
| 31 | + return true; |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -35,133 +35,133 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | class CalendarSearchReport implements XmlDeserializable { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * An array with requested properties. |
|
| 40 | - * |
|
| 41 | - * @var array |
|
| 42 | - */ |
|
| 43 | - public $properties; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * List of property/component filters. |
|
| 47 | - * |
|
| 48 | - * @var array |
|
| 49 | - */ |
|
| 50 | - public $filters; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @var int |
|
| 54 | - */ |
|
| 55 | - public $limit; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @var int |
|
| 59 | - */ |
|
| 60 | - public $offset; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * The deserialize method is called during xml parsing. |
|
| 64 | - * |
|
| 65 | - * This method is called statically, this is because in theory this method |
|
| 66 | - * may be used as a type of constructor, or factory method. |
|
| 67 | - * |
|
| 68 | - * Often you want to return an instance of the current class, but you are |
|
| 69 | - * free to return other data as well. |
|
| 70 | - * |
|
| 71 | - * You are responsible for advancing the reader to the next element. Not |
|
| 72 | - * doing anything will result in a never-ending loop. |
|
| 73 | - * |
|
| 74 | - * If you just want to skip parsing for this element altogether, you can |
|
| 75 | - * just call $reader->next(); |
|
| 76 | - * |
|
| 77 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 78 | - * the next element. |
|
| 79 | - * |
|
| 80 | - * @param Reader $reader |
|
| 81 | - * @return mixed |
|
| 82 | - */ |
|
| 83 | - public static function xmlDeserialize(Reader $reader) { |
|
| 84 | - $elems = $reader->parseInnerTree([ |
|
| 85 | - '{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter', |
|
| 86 | - '{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter', |
|
| 87 | - '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter', |
|
| 88 | - '{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter', |
|
| 89 | - '{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter', |
|
| 90 | - '{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter', |
|
| 91 | - '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 92 | - ]); |
|
| 93 | - |
|
| 94 | - $newProps = [ |
|
| 95 | - 'filters' => [], |
|
| 96 | - 'properties' => [], |
|
| 97 | - 'limit' => null, |
|
| 98 | - 'offset' => null |
|
| 99 | - ]; |
|
| 100 | - |
|
| 101 | - if (!is_array($elems)) { |
|
| 102 | - $elems = []; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - foreach ($elems as $elem) { |
|
| 106 | - switch ($elem['name']) { |
|
| 107 | - case '{DAV:}prop': |
|
| 108 | - $newProps['properties'] = array_keys($elem['value']); |
|
| 109 | - break; |
|
| 110 | - case '{' . SearchPlugin::NS_Nextcloud . '}filter': |
|
| 111 | - foreach ($elem['value'] as $subElem) { |
|
| 112 | - if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') { |
|
| 113 | - if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) { |
|
| 114 | - $newProps['filters']['comps'] = []; |
|
| 115 | - } |
|
| 116 | - $newProps['filters']['comps'][] = $subElem['value']; |
|
| 117 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') { |
|
| 118 | - if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) { |
|
| 119 | - $newProps['filters']['props'] = []; |
|
| 120 | - } |
|
| 121 | - $newProps['filters']['props'][] = $subElem['value']; |
|
| 122 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') { |
|
| 123 | - if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) { |
|
| 124 | - $newProps['filters']['params'] = []; |
|
| 125 | - } |
|
| 126 | - $newProps['filters']['params'][] = $subElem['value']; |
|
| 127 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') { |
|
| 128 | - $newProps['filters']['search-term'] = $subElem['value']; |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - break; |
|
| 132 | - case '{' . SearchPlugin::NS_Nextcloud . '}limit': |
|
| 133 | - $newProps['limit'] = $elem['value']; |
|
| 134 | - break; |
|
| 135 | - case '{' . SearchPlugin::NS_Nextcloud . '}offset': |
|
| 136 | - $newProps['offset'] = $elem['value']; |
|
| 137 | - break; |
|
| 138 | - |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - if (empty($newProps['filters'])) { |
|
| 143 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request'); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params'])); |
|
| 147 | - $noCompsDefined = empty($newProps['filters']['comps']); |
|
| 148 | - if ($propsOrParamsDefined && $noCompsDefined) { |
|
| 149 | - throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter'); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if (!isset($newProps['filters']['search-term'])) { |
|
| 153 | - throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request'); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) { |
|
| 157 | - throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request'); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - |
|
| 161 | - $obj = new self(); |
|
| 162 | - foreach ($newProps as $key => $value) { |
|
| 163 | - $obj->$key = $value; |
|
| 164 | - } |
|
| 165 | - return $obj; |
|
| 166 | - } |
|
| 38 | + /** |
|
| 39 | + * An array with requested properties. |
|
| 40 | + * |
|
| 41 | + * @var array |
|
| 42 | + */ |
|
| 43 | + public $properties; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * List of property/component filters. |
|
| 47 | + * |
|
| 48 | + * @var array |
|
| 49 | + */ |
|
| 50 | + public $filters; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @var int |
|
| 54 | + */ |
|
| 55 | + public $limit; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @var int |
|
| 59 | + */ |
|
| 60 | + public $offset; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * The deserialize method is called during xml parsing. |
|
| 64 | + * |
|
| 65 | + * This method is called statically, this is because in theory this method |
|
| 66 | + * may be used as a type of constructor, or factory method. |
|
| 67 | + * |
|
| 68 | + * Often you want to return an instance of the current class, but you are |
|
| 69 | + * free to return other data as well. |
|
| 70 | + * |
|
| 71 | + * You are responsible for advancing the reader to the next element. Not |
|
| 72 | + * doing anything will result in a never-ending loop. |
|
| 73 | + * |
|
| 74 | + * If you just want to skip parsing for this element altogether, you can |
|
| 75 | + * just call $reader->next(); |
|
| 76 | + * |
|
| 77 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 78 | + * the next element. |
|
| 79 | + * |
|
| 80 | + * @param Reader $reader |
|
| 81 | + * @return mixed |
|
| 82 | + */ |
|
| 83 | + public static function xmlDeserialize(Reader $reader) { |
|
| 84 | + $elems = $reader->parseInnerTree([ |
|
| 85 | + '{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter', |
|
| 86 | + '{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter', |
|
| 87 | + '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter', |
|
| 88 | + '{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter', |
|
| 89 | + '{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter', |
|
| 90 | + '{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter', |
|
| 91 | + '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 92 | + ]); |
|
| 93 | + |
|
| 94 | + $newProps = [ |
|
| 95 | + 'filters' => [], |
|
| 96 | + 'properties' => [], |
|
| 97 | + 'limit' => null, |
|
| 98 | + 'offset' => null |
|
| 99 | + ]; |
|
| 100 | + |
|
| 101 | + if (!is_array($elems)) { |
|
| 102 | + $elems = []; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + foreach ($elems as $elem) { |
|
| 106 | + switch ($elem['name']) { |
|
| 107 | + case '{DAV:}prop': |
|
| 108 | + $newProps['properties'] = array_keys($elem['value']); |
|
| 109 | + break; |
|
| 110 | + case '{' . SearchPlugin::NS_Nextcloud . '}filter': |
|
| 111 | + foreach ($elem['value'] as $subElem) { |
|
| 112 | + if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') { |
|
| 113 | + if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) { |
|
| 114 | + $newProps['filters']['comps'] = []; |
|
| 115 | + } |
|
| 116 | + $newProps['filters']['comps'][] = $subElem['value']; |
|
| 117 | + } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') { |
|
| 118 | + if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) { |
|
| 119 | + $newProps['filters']['props'] = []; |
|
| 120 | + } |
|
| 121 | + $newProps['filters']['props'][] = $subElem['value']; |
|
| 122 | + } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') { |
|
| 123 | + if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) { |
|
| 124 | + $newProps['filters']['params'] = []; |
|
| 125 | + } |
|
| 126 | + $newProps['filters']['params'][] = $subElem['value']; |
|
| 127 | + } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') { |
|
| 128 | + $newProps['filters']['search-term'] = $subElem['value']; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + break; |
|
| 132 | + case '{' . SearchPlugin::NS_Nextcloud . '}limit': |
|
| 133 | + $newProps['limit'] = $elem['value']; |
|
| 134 | + break; |
|
| 135 | + case '{' . SearchPlugin::NS_Nextcloud . '}offset': |
|
| 136 | + $newProps['offset'] = $elem['value']; |
|
| 137 | + break; |
|
| 138 | + |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + if (empty($newProps['filters'])) { |
|
| 143 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request'); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params'])); |
|
| 147 | + $noCompsDefined = empty($newProps['filters']['comps']); |
|
| 148 | + if ($propsOrParamsDefined && $noCompsDefined) { |
|
| 149 | + throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter'); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if (!isset($newProps['filters']['search-term'])) { |
|
| 153 | + throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request'); |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) { |
|
| 157 | + throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request'); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + |
|
| 161 | + $obj = new self(); |
|
| 162 | + foreach ($newProps as $key => $value) { |
|
| 163 | + $obj->$key = $value; |
|
| 164 | + } |
|
| 165 | + return $obj; |
|
| 166 | + } |
|
| 167 | 167 | } |
@@ -27,21 +27,21 @@ |
||
| 27 | 27 | |
| 28 | 28 | class CompFilter implements XmlDeserializable { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param Reader $reader |
|
| 32 | - * @throws BadRequest |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public static function xmlDeserialize(Reader $reader) { |
|
| 36 | - $att = $reader->parseAttributes(); |
|
| 37 | - $componentName = $att['name']; |
|
| 30 | + /** |
|
| 31 | + * @param Reader $reader |
|
| 32 | + * @throws BadRequest |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public static function xmlDeserialize(Reader $reader) { |
|
| 36 | + $att = $reader->parseAttributes(); |
|
| 37 | + $componentName = $att['name']; |
|
| 38 | 38 | |
| 39 | - $reader->parseInnerTree(); |
|
| 39 | + $reader->parseInnerTree(); |
|
| 40 | 40 | |
| 41 | - if (!is_string($componentName)) { |
|
| 42 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute'); |
|
| 43 | - } |
|
| 41 | + if (!is_string($componentName)) { |
|
| 42 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute'); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return $componentName; |
|
| 46 | - } |
|
| 45 | + return $componentName; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -27,17 +27,17 @@ |
||
| 27 | 27 | |
| 28 | 28 | class SearchTermFilter implements XmlDeserializable { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param Reader $reader |
|
| 32 | - * @throws BadRequest |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public static function xmlDeserialize(Reader $reader) { |
|
| 36 | - $value = $reader->parseInnerTree(); |
|
| 37 | - if (!is_string($value)) { |
|
| 38 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value'); |
|
| 39 | - } |
|
| 30 | + /** |
|
| 31 | + * @param Reader $reader |
|
| 32 | + * @throws BadRequest |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public static function xmlDeserialize(Reader $reader) { |
|
| 36 | + $value = $reader->parseInnerTree(); |
|
| 37 | + if (!is_string($value)) { |
|
| 38 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value'); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - return $value; |
|
| 42 | - } |
|
| 41 | + return $value; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -27,21 +27,21 @@ |
||
| 27 | 27 | |
| 28 | 28 | class PropFilter implements XmlDeserializable { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param Reader $reader |
|
| 32 | - * @throws BadRequest |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public static function xmlDeserialize(Reader $reader) { |
|
| 36 | - $att = $reader->parseAttributes(); |
|
| 37 | - $componentName = $att['name']; |
|
| 30 | + /** |
|
| 31 | + * @param Reader $reader |
|
| 32 | + * @throws BadRequest |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public static function xmlDeserialize(Reader $reader) { |
|
| 36 | + $att = $reader->parseAttributes(); |
|
| 37 | + $componentName = $att['name']; |
|
| 38 | 38 | |
| 39 | - $reader->parseInnerTree(); |
|
| 39 | + $reader->parseInnerTree(); |
|
| 40 | 40 | |
| 41 | - if (!is_string($componentName)) { |
|
| 42 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute'); |
|
| 43 | - } |
|
| 41 | + if (!is_string($componentName)) { |
|
| 42 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute'); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return $componentName; |
|
| 46 | - } |
|
| 45 | + return $componentName; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -27,28 +27,28 @@ |
||
| 27 | 27 | |
| 28 | 28 | class ParamFilter implements XmlDeserializable { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param Reader $reader |
|
| 32 | - * @throws BadRequest |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public static function xmlDeserialize(Reader $reader) { |
|
| 36 | - $att = $reader->parseAttributes(); |
|
| 37 | - $property = $att['property']; |
|
| 38 | - $parameter = $att['name']; |
|
| 30 | + /** |
|
| 31 | + * @param Reader $reader |
|
| 32 | + * @throws BadRequest |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public static function xmlDeserialize(Reader $reader) { |
|
| 36 | + $att = $reader->parseAttributes(); |
|
| 37 | + $property = $att['property']; |
|
| 38 | + $parameter = $att['name']; |
|
| 39 | 39 | |
| 40 | - $reader->parseInnerTree(); |
|
| 40 | + $reader->parseInnerTree(); |
|
| 41 | 41 | |
| 42 | - if (!is_string($property)) { |
|
| 43 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute'); |
|
| 44 | - } |
|
| 45 | - if (!is_string($parameter)) { |
|
| 46 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute'); |
|
| 47 | - } |
|
| 42 | + if (!is_string($property)) { |
|
| 43 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute'); |
|
| 44 | + } |
|
| 45 | + if (!is_string($parameter)) { |
|
| 46 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute'); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - return [ |
|
| 50 | - 'property' => $property, |
|
| 51 | - 'parameter' => $parameter, |
|
| 52 | - ]; |
|
| 53 | - } |
|
| 49 | + return [ |
|
| 50 | + 'property' => $property, |
|
| 51 | + 'parameter' => $parameter, |
|
| 52 | + ]; |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -36,101 +36,101 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | trait VisibilityTrait { |
| 38 | 38 | |
| 39 | - /** @var int visibility */ |
|
| 40 | - protected $visibility = BackendService::VISIBILITY_DEFAULT; |
|
| 39 | + /** @var int visibility */ |
|
| 40 | + protected $visibility = BackendService::VISIBILITY_DEFAULT; |
|
| 41 | 41 | |
| 42 | - /** @var int allowed visibilities */ |
|
| 43 | - protected $allowedVisibility = BackendService::VISIBILITY_DEFAULT; |
|
| 42 | + /** @var int allowed visibilities */ |
|
| 43 | + protected $allowedVisibility = BackendService::VISIBILITY_DEFAULT; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @return int |
|
| 47 | - */ |
|
| 48 | - public function getVisibility() { |
|
| 49 | - return $this->visibility; |
|
| 50 | - } |
|
| 45 | + /** |
|
| 46 | + * @return int |
|
| 47 | + */ |
|
| 48 | + public function getVisibility() { |
|
| 49 | + return $this->visibility; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Check if the backend is visible for a user type |
|
| 54 | - * |
|
| 55 | - * @param int $visibility |
|
| 56 | - * @return bool |
|
| 57 | - */ |
|
| 58 | - public function isVisibleFor($visibility) { |
|
| 59 | - if ($this->visibility & $visibility) { |
|
| 60 | - return true; |
|
| 61 | - } |
|
| 62 | - return false; |
|
| 63 | - } |
|
| 52 | + /** |
|
| 53 | + * Check if the backend is visible for a user type |
|
| 54 | + * |
|
| 55 | + * @param int $visibility |
|
| 56 | + * @return bool |
|
| 57 | + */ |
|
| 58 | + public function isVisibleFor($visibility) { |
|
| 59 | + if ($this->visibility & $visibility) { |
|
| 60 | + return true; |
|
| 61 | + } |
|
| 62 | + return false; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @param int $visibility |
|
| 67 | - * @return self |
|
| 68 | - */ |
|
| 69 | - public function setVisibility($visibility) { |
|
| 70 | - $this->visibility = $visibility; |
|
| 71 | - $this->allowedVisibility |= $visibility; |
|
| 72 | - return $this; |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * @param int $visibility |
|
| 67 | + * @return self |
|
| 68 | + */ |
|
| 69 | + public function setVisibility($visibility) { |
|
| 70 | + $this->visibility = $visibility; |
|
| 71 | + $this->allowedVisibility |= $visibility; |
|
| 72 | + return $this; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @param int $visibility |
|
| 77 | - * @return self |
|
| 78 | - */ |
|
| 79 | - public function addVisibility($visibility) { |
|
| 80 | - return $this->setVisibility($this->visibility | $visibility); |
|
| 81 | - } |
|
| 75 | + /** |
|
| 76 | + * @param int $visibility |
|
| 77 | + * @return self |
|
| 78 | + */ |
|
| 79 | + public function addVisibility($visibility) { |
|
| 80 | + return $this->setVisibility($this->visibility | $visibility); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @param int $visibility |
|
| 85 | - * @return self |
|
| 86 | - */ |
|
| 87 | - public function removeVisibility($visibility) { |
|
| 88 | - return $this->setVisibility($this->visibility & ~$visibility); |
|
| 89 | - } |
|
| 83 | + /** |
|
| 84 | + * @param int $visibility |
|
| 85 | + * @return self |
|
| 86 | + */ |
|
| 87 | + public function removeVisibility($visibility) { |
|
| 88 | + return $this->setVisibility($this->visibility & ~$visibility); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * @return int |
|
| 93 | - */ |
|
| 94 | - public function getAllowedVisibility() { |
|
| 95 | - return $this->allowedVisibility; |
|
| 96 | - } |
|
| 91 | + /** |
|
| 92 | + * @return int |
|
| 93 | + */ |
|
| 94 | + public function getAllowedVisibility() { |
|
| 95 | + return $this->allowedVisibility; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Check if the backend is allowed to be visible for a user type |
|
| 100 | - * |
|
| 101 | - * @param int $allowedVisibility |
|
| 102 | - * @return bool |
|
| 103 | - */ |
|
| 104 | - public function isAllowedVisibleFor($allowedVisibility) { |
|
| 105 | - if ($this->allowedVisibility & $allowedVisibility) { |
|
| 106 | - return true; |
|
| 107 | - } |
|
| 108 | - return false; |
|
| 109 | - } |
|
| 98 | + /** |
|
| 99 | + * Check if the backend is allowed to be visible for a user type |
|
| 100 | + * |
|
| 101 | + * @param int $allowedVisibility |
|
| 102 | + * @return bool |
|
| 103 | + */ |
|
| 104 | + public function isAllowedVisibleFor($allowedVisibility) { |
|
| 105 | + if ($this->allowedVisibility & $allowedVisibility) { |
|
| 106 | + return true; |
|
| 107 | + } |
|
| 108 | + return false; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * @param int $allowedVisibility |
|
| 113 | - * @return self |
|
| 114 | - */ |
|
| 115 | - public function setAllowedVisibility($allowedVisibility) { |
|
| 116 | - $this->allowedVisibility = $allowedVisibility; |
|
| 117 | - $this->visibility &= $allowedVisibility; |
|
| 118 | - return $this; |
|
| 119 | - } |
|
| 111 | + /** |
|
| 112 | + * @param int $allowedVisibility |
|
| 113 | + * @return self |
|
| 114 | + */ |
|
| 115 | + public function setAllowedVisibility($allowedVisibility) { |
|
| 116 | + $this->allowedVisibility = $allowedVisibility; |
|
| 117 | + $this->visibility &= $allowedVisibility; |
|
| 118 | + return $this; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * @param int $allowedVisibility |
|
| 123 | - * @return self |
|
| 124 | - */ |
|
| 125 | - public function addAllowedVisibility($allowedVisibility) { |
|
| 126 | - return $this->setAllowedVisibility($this->allowedVisibility | $allowedVisibility); |
|
| 127 | - } |
|
| 121 | + /** |
|
| 122 | + * @param int $allowedVisibility |
|
| 123 | + * @return self |
|
| 124 | + */ |
|
| 125 | + public function addAllowedVisibility($allowedVisibility) { |
|
| 126 | + return $this->setAllowedVisibility($this->allowedVisibility | $allowedVisibility); |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * @param int $allowedVisibility |
|
| 131 | - * @return self |
|
| 132 | - */ |
|
| 133 | - public function removeAllowedVisibility($allowedVisibility) { |
|
| 134 | - return $this->setAllowedVisibility($this->allowedVisibility & ~$allowedVisibility); |
|
| 135 | - } |
|
| 129 | + /** |
|
| 130 | + * @param int $allowedVisibility |
|
| 131 | + * @return self |
|
| 132 | + */ |
|
| 133 | + public function removeAllowedVisibility($allowedVisibility) { |
|
| 134 | + return $this->setAllowedVisibility($this->allowedVisibility & ~$allowedVisibility); |
|
| 135 | + } |
|
| 136 | 136 | } |
@@ -28,11 +28,11 @@ |
||
| 28 | 28 | * Builtin authentication mechanism, for legacy backends |
| 29 | 29 | */ |
| 30 | 30 | class Builtin extends AuthMechanism { |
| 31 | - public function __construct(IL10N $l) { |
|
| 32 | - $this |
|
| 33 | - ->setIdentifier('builtin::builtin') |
|
| 34 | - ->setScheme(self::SCHEME_BUILTIN) |
|
| 35 | - ->setText($l->t('Builtin')) |
|
| 36 | - ; |
|
| 37 | - } |
|
| 31 | + public function __construct(IL10N $l) { |
|
| 32 | + $this |
|
| 33 | + ->setIdentifier('builtin::builtin') |
|
| 34 | + ->setScheme(self::SCHEME_BUILTIN) |
|
| 35 | + ->setText($l->t('Builtin')) |
|
| 36 | + ; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -28,11 +28,11 @@ |
||
| 28 | 28 | * Null authentication mechanism |
| 29 | 29 | */ |
| 30 | 30 | class NullMechanism extends AuthMechanism { |
| 31 | - public function __construct(IL10N $l) { |
|
| 32 | - $this |
|
| 33 | - ->setIdentifier('null::null') |
|
| 34 | - ->setScheme(self::SCHEME_NULL) |
|
| 35 | - ->setText($l->t('None')) |
|
| 36 | - ; |
|
| 37 | - } |
|
| 31 | + public function __construct(IL10N $l) { |
|
| 32 | + $this |
|
| 33 | + ->setIdentifier('null::null') |
|
| 34 | + ->setScheme(self::SCHEME_NULL) |
|
| 35 | + ->setText($l->t('None')) |
|
| 36 | + ; |
|
| 37 | + } |
|
| 38 | 38 | } |