@@ -30,25 +30,25 @@ |
||
30 | 30 | */ |
31 | 31 | class User extends \Sabre\CalDAV\Principal\User { |
32 | 32 | |
33 | - /** |
|
34 | - * Returns a list of ACE's for this node. |
|
35 | - * |
|
36 | - * Each ACE has the following properties: |
|
37 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
38 | - * currently the only supported privileges |
|
39 | - * * 'principal', a url to the principal who owns the node |
|
40 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
41 | - * be updated. |
|
42 | - * |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function getACL() { |
|
46 | - $acl = parent::getACL(); |
|
47 | - $acl[] = [ |
|
48 | - 'privilege' => '{DAV:}read', |
|
49 | - 'principal' => '{DAV:}authenticated', |
|
50 | - 'protected' => true, |
|
51 | - ]; |
|
52 | - return $acl; |
|
53 | - } |
|
33 | + /** |
|
34 | + * Returns a list of ACE's for this node. |
|
35 | + * |
|
36 | + * Each ACE has the following properties: |
|
37 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
38 | + * currently the only supported privileges |
|
39 | + * * 'principal', a url to the principal who owns the node |
|
40 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
41 | + * be updated. |
|
42 | + * |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function getACL() { |
|
46 | + $acl = parent::getACL(); |
|
47 | + $acl[] = [ |
|
48 | + 'privilege' => '{DAV:}read', |
|
49 | + 'principal' => '{DAV:}authenticated', |
|
50 | + 'protected' => true, |
|
51 | + ]; |
|
52 | + return $acl; |
|
53 | + } |
|
54 | 54 | } |
@@ -32,17 +32,17 @@ |
||
32 | 32 | |
33 | 33 | class OffsetFilter implements XmlDeserializable { |
34 | 34 | |
35 | - /** |
|
36 | - * @param Reader $reader |
|
37 | - * @throws BadRequest |
|
38 | - * @return int |
|
39 | - */ |
|
40 | - public static function xmlDeserialize(Reader $reader) { |
|
41 | - $value = $reader->parseInnerTree(); |
|
42 | - if (!is_int($value) && !is_string($value)) { |
|
43 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); |
|
44 | - } |
|
35 | + /** |
|
36 | + * @param Reader $reader |
|
37 | + * @throws BadRequest |
|
38 | + * @return int |
|
39 | + */ |
|
40 | + public static function xmlDeserialize(Reader $reader) { |
|
41 | + $value = $reader->parseInnerTree(); |
|
42 | + if (!is_int($value) && !is_string($value)) { |
|
43 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); |
|
44 | + } |
|
45 | 45 | |
46 | - return (int)$value; |
|
47 | - } |
|
46 | + return (int)$value; |
|
47 | + } |
|
48 | 48 | } |
@@ -40,9 +40,9 @@ |
||
40 | 40 | public static function xmlDeserialize(Reader $reader) { |
41 | 41 | $value = $reader->parseInnerTree(); |
42 | 42 | if (!is_int($value) && !is_string($value)) { |
43 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); |
|
43 | + throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}offset has illegal value'); |
|
44 | 44 | } |
45 | 45 | |
46 | - return (int)$value; |
|
46 | + return (int) $value; |
|
47 | 47 | } |
48 | 48 | } |
@@ -32,17 +32,17 @@ |
||
32 | 32 | |
33 | 33 | class LimitFilter implements XmlDeserializable { |
34 | 34 | |
35 | - /** |
|
36 | - * @param Reader $reader |
|
37 | - * @throws BadRequest |
|
38 | - * @return int |
|
39 | - */ |
|
40 | - public static function xmlDeserialize(Reader $reader) { |
|
41 | - $value = $reader->parseInnerTree(); |
|
42 | - if (!is_int($value) && !is_string($value)) { |
|
43 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value'); |
|
44 | - } |
|
35 | + /** |
|
36 | + * @param Reader $reader |
|
37 | + * @throws BadRequest |
|
38 | + * @return int |
|
39 | + */ |
|
40 | + public static function xmlDeserialize(Reader $reader) { |
|
41 | + $value = $reader->parseInnerTree(); |
|
42 | + if (!is_int($value) && !is_string($value)) { |
|
43 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value'); |
|
44 | + } |
|
45 | 45 | |
46 | - return (int)$value; |
|
47 | - } |
|
46 | + return (int)$value; |
|
47 | + } |
|
48 | 48 | } |
@@ -40,9 +40,9 @@ |
||
40 | 40 | public static function xmlDeserialize(Reader $reader) { |
41 | 41 | $value = $reader->parseInnerTree(); |
42 | 42 | if (!is_int($value) && !is_string($value)) { |
43 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value'); |
|
43 | + throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}limit has illegal value'); |
|
44 | 44 | } |
45 | 45 | |
46 | - return (int)$value; |
|
46 | + return (int) $value; |
|
47 | 47 | } |
48 | 48 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | use OCP\WorkflowEngine\IManager; |
29 | 29 | |
30 | 30 | class Admin extends ASettings { |
31 | - public function getScope(): int { |
|
32 | - return IManager::SCOPE_ADMIN; |
|
33 | - } |
|
31 | + public function getScope(): int { |
|
32 | + return IManager::SCOPE_ADMIN; |
|
33 | + } |
|
34 | 34 | } |
@@ -32,17 +32,17 @@ |
||
32 | 32 | * Amazon S3 access key authentication |
33 | 33 | */ |
34 | 34 | class AccessKey extends AuthMechanism { |
35 | - public const SCHEME_AMAZONS3_ACCESSKEY = 'amazons3_accesskey'; |
|
35 | + public const SCHEME_AMAZONS3_ACCESSKEY = 'amazons3_accesskey'; |
|
36 | 36 | |
37 | - public function __construct(IL10N $l) { |
|
38 | - $this |
|
39 | - ->setIdentifier('amazons3::accesskey') |
|
40 | - ->setScheme(self::SCHEME_AMAZONS3_ACCESSKEY) |
|
41 | - ->setText($l->t('Access key')) |
|
42 | - ->addParameters([ |
|
43 | - new DefinitionParameter('key', $l->t('Access key')), |
|
44 | - (new DefinitionParameter('secret', $l->t('Secret key'))) |
|
45 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
46 | - ]); |
|
47 | - } |
|
37 | + public function __construct(IL10N $l) { |
|
38 | + $this |
|
39 | + ->setIdentifier('amazons3::accesskey') |
|
40 | + ->setScheme(self::SCHEME_AMAZONS3_ACCESSKEY) |
|
41 | + ->setText($l->t('Access key')) |
|
42 | + ->addParameters([ |
|
43 | + new DefinitionParameter('key', $l->t('Access key')), |
|
44 | + (new DefinitionParameter('secret', $l->t('Secret key'))) |
|
45 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
46 | + ]); |
|
47 | + } |
|
48 | 48 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | use Sabre\DAV\IFile; |
31 | 31 | |
32 | 32 | abstract class AbstractTrashFile extends AbstractTrash implements IFile, ITrash { |
33 | - public function put($data) { |
|
34 | - throw new Forbidden(); |
|
35 | - } |
|
33 | + public function put($data) { |
|
34 | + throw new Forbidden(); |
|
35 | + } |
|
36 | 36 | |
37 | - public function setName($name) { |
|
38 | - throw new Forbidden(); |
|
39 | - } |
|
37 | + public function setName($name) { |
|
38 | + throw new Forbidden(); |
|
39 | + } |
|
40 | 40 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $ns = '{http://nextcloud.com/ns}'; |
61 | 61 | |
62 | 62 | if ($node instanceof Card) { |
63 | - $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
63 | + $propFind->handle($ns.'has-photo', function() use ($node) { |
|
64 | 64 | $vcard = Reader::read($node->get()); |
65 | 65 | return $vcard instanceof VCard |
66 | 66 | && $vcard->PHOTO |
@@ -18,69 +18,69 @@ |
||
18 | 18 | |
19 | 19 | class HasPhotoPlugin extends ServerPlugin { |
20 | 20 | |
21 | - /** @var Server */ |
|
22 | - protected $server; |
|
21 | + /** @var Server */ |
|
22 | + protected $server; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Initializes the plugin and registers event handlers |
|
26 | - * |
|
27 | - * @param Server $server |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function initialize(Server $server) { |
|
31 | - $server->on('propFind', [$this, 'propFind']); |
|
32 | - } |
|
24 | + /** |
|
25 | + * Initializes the plugin and registers event handlers |
|
26 | + * |
|
27 | + * @param Server $server |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function initialize(Server $server) { |
|
31 | + $server->on('propFind', [$this, 'propFind']); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Adds all CardDAV-specific properties |
|
36 | - * |
|
37 | - * @param PropFind $propFind |
|
38 | - * @param INode $node |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - public function propFind(PropFind $propFind, INode $node) { |
|
42 | - $ns = '{http://nextcloud.com/ns}'; |
|
34 | + /** |
|
35 | + * Adds all CardDAV-specific properties |
|
36 | + * |
|
37 | + * @param PropFind $propFind |
|
38 | + * @param INode $node |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + public function propFind(PropFind $propFind, INode $node) { |
|
42 | + $ns = '{http://nextcloud.com/ns}'; |
|
43 | 43 | |
44 | - if ($node instanceof Card) { |
|
45 | - $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
46 | - $vcard = Reader::read($node->get()); |
|
47 | - return $vcard instanceof VCard |
|
48 | - && $vcard->PHOTO |
|
49 | - // Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/ |
|
50 | - && (!str_starts_with($vcard->PHOTO->getValue(), 'data:') |
|
51 | - || str_starts_with($vcard->PHOTO->getValue(), 'data:image/')) |
|
52 | - ; |
|
53 | - }); |
|
54 | - } |
|
55 | - } |
|
44 | + if ($node instanceof Card) { |
|
45 | + $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
46 | + $vcard = Reader::read($node->get()); |
|
47 | + return $vcard instanceof VCard |
|
48 | + && $vcard->PHOTO |
|
49 | + // Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/ |
|
50 | + && (!str_starts_with($vcard->PHOTO->getValue(), 'data:') |
|
51 | + || str_starts_with($vcard->PHOTO->getValue(), 'data:image/')) |
|
52 | + ; |
|
53 | + }); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Returns a plugin name. |
|
59 | - * |
|
60 | - * Using this name other plugins will be able to access other plugins |
|
61 | - * using \Sabre\DAV\Server::getPlugin |
|
62 | - * |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getPluginName() { |
|
66 | - return 'vcard-has-photo'; |
|
67 | - } |
|
57 | + /** |
|
58 | + * Returns a plugin name. |
|
59 | + * |
|
60 | + * Using this name other plugins will be able to access other plugins |
|
61 | + * using \Sabre\DAV\Server::getPlugin |
|
62 | + * |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getPluginName() { |
|
66 | + return 'vcard-has-photo'; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Returns a bunch of meta-data about the plugin. |
|
71 | - * |
|
72 | - * Providing this information is optional, and is mainly displayed by the |
|
73 | - * Browser plugin. |
|
74 | - * |
|
75 | - * The description key in the returned array may contain html and will not |
|
76 | - * be sanitized. |
|
77 | - * |
|
78 | - * @return array |
|
79 | - */ |
|
80 | - public function getPluginInfo() { |
|
81 | - return [ |
|
82 | - 'name' => $this->getPluginName(), |
|
83 | - 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' |
|
84 | - ]; |
|
85 | - } |
|
69 | + /** |
|
70 | + * Returns a bunch of meta-data about the plugin. |
|
71 | + * |
|
72 | + * Providing this information is optional, and is mainly displayed by the |
|
73 | + * Browser plugin. |
|
74 | + * |
|
75 | + * The description key in the returned array may contain html and will not |
|
76 | + * be sanitized. |
|
77 | + * |
|
78 | + * @return array |
|
79 | + */ |
|
80 | + public function getPluginInfo() { |
|
81 | + return [ |
|
82 | + 'name' => $this->getPluginName(), |
|
83 | + 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' |
|
84 | + ]; |
|
85 | + } |
|
86 | 86 | } |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | protected function getTableName(bool $includePrefix = true) { |
37 | 37 | $p = $includePrefix ? '*PREFIX*' : ''; |
38 | - return $p . 'ldap_user_mapping'; |
|
38 | + return $p.'ldap_user_mapping'; |
|
39 | 39 | } |
40 | 40 | } |
@@ -20,45 +20,45 @@ |
||
20 | 20 | */ |
21 | 21 | class UserMapping extends AbstractMapping { |
22 | 22 | |
23 | - protected const PROV_API_REGEX = '/\/ocs\/v[1-9].php\/cloud\/(groups|users)/'; |
|
23 | + protected const PROV_API_REGEX = '/\/ocs\/v[1-9].php\/cloud\/(groups|users)/'; |
|
24 | 24 | |
25 | - public function __construct( |
|
26 | - IDBConnection $dbc, |
|
27 | - private IAssertion $assertion, |
|
28 | - ) { |
|
29 | - parent::__construct($dbc); |
|
30 | - } |
|
25 | + public function __construct( |
|
26 | + IDBConnection $dbc, |
|
27 | + private IAssertion $assertion, |
|
28 | + ) { |
|
29 | + parent::__construct($dbc); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * @throws HintException |
|
34 | - */ |
|
35 | - public function map($fdn, $name, $uuid): bool { |
|
36 | - try { |
|
37 | - $this->assertion->createUserIsLegit(); |
|
38 | - } catch (HintException $e) { |
|
39 | - static $isProvisioningApi = null; |
|
32 | + /** |
|
33 | + * @throws HintException |
|
34 | + */ |
|
35 | + public function map($fdn, $name, $uuid): bool { |
|
36 | + try { |
|
37 | + $this->assertion->createUserIsLegit(); |
|
38 | + } catch (HintException $e) { |
|
39 | + static $isProvisioningApi = null; |
|
40 | 40 | |
41 | - if ($isProvisioningApi === null) { |
|
42 | - $request = Server::get(IRequest::class); |
|
43 | - $isProvisioningApi = \preg_match(self::PROV_API_REGEX, $request->getRequestUri()) === 1; |
|
44 | - } |
|
45 | - if ($isProvisioningApi) { |
|
46 | - // only throw when prov API is being used, since functionality |
|
47 | - // should not break for end users (e.g. when sharing). |
|
48 | - // On direct API usage, e.g. on users page, this is desired. |
|
49 | - throw $e; |
|
50 | - } |
|
51 | - return false; |
|
52 | - } |
|
53 | - return parent::map($fdn, $name, $uuid); |
|
54 | - } |
|
41 | + if ($isProvisioningApi === null) { |
|
42 | + $request = Server::get(IRequest::class); |
|
43 | + $isProvisioningApi = \preg_match(self::PROV_API_REGEX, $request->getRequestUri()) === 1; |
|
44 | + } |
|
45 | + if ($isProvisioningApi) { |
|
46 | + // only throw when prov API is being used, since functionality |
|
47 | + // should not break for end users (e.g. when sharing). |
|
48 | + // On direct API usage, e.g. on users page, this is desired. |
|
49 | + throw $e; |
|
50 | + } |
|
51 | + return false; |
|
52 | + } |
|
53 | + return parent::map($fdn, $name, $uuid); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * returns the DB table name which holds the mappings |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - protected function getTableName(bool $includePrefix = true) { |
|
61 | - $p = $includePrefix ? '*PREFIX*' : ''; |
|
62 | - return $p . 'ldap_user_mapping'; |
|
63 | - } |
|
56 | + /** |
|
57 | + * returns the DB table name which holds the mappings |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + protected function getTableName(bool $includePrefix = true) { |
|
61 | + $p = $includePrefix ? '*PREFIX*' : ''; |
|
62 | + return $p . 'ldap_user_mapping'; |
|
63 | + } |
|
64 | 64 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | */ |
30 | 30 | class GroupMapping extends AbstractMapping { |
31 | 31 | |
32 | - /** |
|
33 | - * returns the DB table name which holds the mappings |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - protected function getTableName(bool $includePrefix = true) { |
|
37 | - $p = $includePrefix ? '*PREFIX*' : ''; |
|
38 | - return $p . 'ldap_group_mapping'; |
|
39 | - } |
|
32 | + /** |
|
33 | + * returns the DB table name which holds the mappings |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + protected function getTableName(bool $includePrefix = true) { |
|
37 | + $p = $includePrefix ? '*PREFIX*' : ''; |
|
38 | + return $p . 'ldap_group_mapping'; |
|
39 | + } |
|
40 | 40 | } |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | protected function getTableName(bool $includePrefix = true) { |
37 | 37 | $p = $includePrefix ? '*PREFIX*' : ''; |
38 | - return $p . 'ldap_group_mapping'; |
|
38 | + return $p.'ldap_group_mapping'; |
|
39 | 39 | } |
40 | 40 | } |