@@ -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 | } |
@@ -29,40 +29,40 @@ |
||
29 | 29 | |
30 | 30 | class FedAuth extends AbstractBasic { |
31 | 31 | |
32 | - /** @var DbHandler */ |
|
33 | - private $db; |
|
32 | + /** @var DbHandler */ |
|
33 | + private $db; |
|
34 | 34 | |
35 | - /** |
|
36 | - * FedAuth constructor. |
|
37 | - * |
|
38 | - * @param DbHandler $db |
|
39 | - */ |
|
40 | - public function __construct(DbHandler $db) { |
|
41 | - $this->db = $db; |
|
42 | - $this->principalPrefix = 'principals/system/'; |
|
35 | + /** |
|
36 | + * FedAuth constructor. |
|
37 | + * |
|
38 | + * @param DbHandler $db |
|
39 | + */ |
|
40 | + public function __construct(DbHandler $db) { |
|
41 | + $this->db = $db; |
|
42 | + $this->principalPrefix = 'principals/system/'; |
|
43 | 43 | |
44 | - // setup realm |
|
45 | - $defaults = new \OCP\Defaults(); |
|
46 | - $this->realm = $defaults->getName(); |
|
47 | - } |
|
44 | + // setup realm |
|
45 | + $defaults = new \OCP\Defaults(); |
|
46 | + $this->realm = $defaults->getName(); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Validates a username and password |
|
51 | - * |
|
52 | - * This method should return true or false depending on if login |
|
53 | - * succeeded. |
|
54 | - * |
|
55 | - * @param string $username |
|
56 | - * @param string $password |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - protected function validateUserPass($username, $password) { |
|
60 | - return $this->db->auth($username, $password); |
|
61 | - } |
|
49 | + /** |
|
50 | + * Validates a username and password |
|
51 | + * |
|
52 | + * This method should return true or false depending on if login |
|
53 | + * succeeded. |
|
54 | + * |
|
55 | + * @param string $username |
|
56 | + * @param string $password |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + protected function validateUserPass($username, $password) { |
|
60 | + return $this->db->auth($username, $password); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @inheritdoc |
|
65 | - */ |
|
66 | - public function challenge(RequestInterface $request, ResponseInterface $response) { |
|
67 | - } |
|
63 | + /** |
|
64 | + * @inheritdoc |
|
65 | + */ |
|
66 | + public function challenge(RequestInterface $request, ResponseInterface $response) { |
|
67 | + } |
|
68 | 68 | } |
@@ -29,32 +29,32 @@ |
||
29 | 29 | |
30 | 30 | class LastUsedController extends Controller { |
31 | 31 | |
32 | - /** @var IConfig */ |
|
33 | - protected $config; |
|
32 | + /** @var IConfig */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | - /** @var IUserSession */ |
|
36 | - protected $userSession; |
|
35 | + /** @var IUserSession */ |
|
36 | + protected $userSession; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $appName |
|
40 | - * @param IRequest $request |
|
41 | - * @param IConfig $config |
|
42 | - * @param IUserSession $userSession |
|
43 | - */ |
|
44 | - public function __construct($appName, IRequest $request, IConfig $config, IUserSession $userSession) { |
|
45 | - parent::__construct($appName, $request); |
|
46 | - $this->config = $config; |
|
47 | - $this->userSession = $userSession; |
|
48 | - } |
|
38 | + /** |
|
39 | + * @param string $appName |
|
40 | + * @param IRequest $request |
|
41 | + * @param IConfig $config |
|
42 | + * @param IUserSession $userSession |
|
43 | + */ |
|
44 | + public function __construct($appName, IRequest $request, IConfig $config, IUserSession $userSession) { |
|
45 | + parent::__construct($appName, $request); |
|
46 | + $this->config = $config; |
|
47 | + $this->userSession = $userSession; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @NoAdminRequired |
|
52 | - */ |
|
53 | - public function getLastUsedTagIds() { |
|
54 | - $lastUsed = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'systemtags', 'last_used', '[]'); |
|
55 | - $tagIds = json_decode($lastUsed, true); |
|
56 | - return new DataResponse(array_map(function ($id) { |
|
57 | - return (string) $id; |
|
58 | - }, $tagIds)); |
|
59 | - } |
|
50 | + /** |
|
51 | + * @NoAdminRequired |
|
52 | + */ |
|
53 | + public function getLastUsedTagIds() { |
|
54 | + $lastUsed = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'systemtags', 'last_used', '[]'); |
|
55 | + $tagIds = json_decode($lastUsed, true); |
|
56 | + return new DataResponse(array_map(function ($id) { |
|
57 | + return (string) $id; |
|
58 | + }, $tagIds)); |
|
59 | + } |
|
60 | 60 | } |