@@ -32,13 +32,13 @@ |
||
32 | 32 | * @since 8.0.0 |
33 | 33 | */ |
34 | 34 | interface IExtension { |
35 | - public const METHOD_STREAM = 'stream'; |
|
36 | - public const METHOD_MAIL = 'email'; |
|
37 | - public const METHOD_NOTIFICATION = 'notification'; |
|
35 | + public const METHOD_STREAM = 'stream'; |
|
36 | + public const METHOD_MAIL = 'email'; |
|
37 | + public const METHOD_NOTIFICATION = 'notification'; |
|
38 | 38 | |
39 | - public const PRIORITY_VERYLOW = 10; |
|
40 | - public const PRIORITY_LOW = 20; |
|
41 | - public const PRIORITY_MEDIUM = 30; |
|
42 | - public const PRIORITY_HIGH = 40; |
|
43 | - public const PRIORITY_VERYHIGH = 50; |
|
39 | + public const PRIORITY_VERYLOW = 10; |
|
40 | + public const PRIORITY_LOW = 20; |
|
41 | + public const PRIORITY_MEDIUM = 30; |
|
42 | + public const PRIORITY_HIGH = 40; |
|
43 | + public const PRIORITY_VERYHIGH = 50; |
|
44 | 44 | } |
@@ -32,45 +32,45 @@ |
||
32 | 32 | * @since 14.0.0 |
33 | 33 | */ |
34 | 34 | class BadRequestException extends HintException { |
35 | - private $parameterList; |
|
35 | + private $parameterList; |
|
36 | 36 | |
37 | - /** |
|
38 | - * BadRequestException constructor. |
|
39 | - * |
|
40 | - * @since 14.0.0 |
|
41 | - * |
|
42 | - * @param array $missingParameters |
|
43 | - */ |
|
44 | - public function __construct(array $missingParameters) { |
|
45 | - $l = \OC::$server->getL10N('federation'); |
|
46 | - $this->parameterList = $missingParameters; |
|
47 | - $parameterList = implode(',', $missingParameters); |
|
48 | - $message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList; |
|
49 | - $hint = $l->t('Parameters missing in order to complete the request. Missing Parameters: "%s"', [$parameterList]); |
|
50 | - parent::__construct($message, $hint); |
|
51 | - } |
|
37 | + /** |
|
38 | + * BadRequestException constructor. |
|
39 | + * |
|
40 | + * @since 14.0.0 |
|
41 | + * |
|
42 | + * @param array $missingParameters |
|
43 | + */ |
|
44 | + public function __construct(array $missingParameters) { |
|
45 | + $l = \OC::$server->getL10N('federation'); |
|
46 | + $this->parameterList = $missingParameters; |
|
47 | + $parameterList = implode(',', $missingParameters); |
|
48 | + $message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList; |
|
49 | + $hint = $l->t('Parameters missing in order to complete the request. Missing Parameters: "%s"', [$parameterList]); |
|
50 | + parent::__construct($message, $hint); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * get array with the return message as defined in the OCM API |
|
55 | - * |
|
56 | - * @since 14.0.0 |
|
57 | - * |
|
58 | - * @return array |
|
59 | - */ |
|
60 | - public function getReturnMessage() { |
|
61 | - $result = [ |
|
62 | - 'message' => 'RESOURCE_NOT_FOUND', |
|
63 | - 'validationErrors' => [ |
|
64 | - ] |
|
65 | - ]; |
|
53 | + /** |
|
54 | + * get array with the return message as defined in the OCM API |
|
55 | + * |
|
56 | + * @since 14.0.0 |
|
57 | + * |
|
58 | + * @return array |
|
59 | + */ |
|
60 | + public function getReturnMessage() { |
|
61 | + $result = [ |
|
62 | + 'message' => 'RESOURCE_NOT_FOUND', |
|
63 | + 'validationErrors' => [ |
|
64 | + ] |
|
65 | + ]; |
|
66 | 66 | |
67 | - foreach ($this->parameterList as $missingParameter) { |
|
68 | - $result['validationErrors'] = [ |
|
69 | - 'name' => $missingParameter, |
|
70 | - 'message' => 'NOT_FOUND' |
|
71 | - ]; |
|
72 | - } |
|
67 | + foreach ($this->parameterList as $missingParameter) { |
|
68 | + $result['validationErrors'] = [ |
|
69 | + 'name' => $missingParameter, |
|
70 | + 'message' => 'NOT_FOUND' |
|
71 | + ]; |
|
72 | + } |
|
73 | 73 | |
74 | - return $result; |
|
75 | - } |
|
74 | + return $result; |
|
75 | + } |
|
76 | 76 | } |
@@ -33,115 +33,115 @@ |
||
33 | 33 | |
34 | 34 | class WeatherStatusController extends OCSController { |
35 | 35 | |
36 | - /** @var string */ |
|
37 | - private $userId; |
|
36 | + /** @var string */ |
|
37 | + private $userId; |
|
38 | 38 | |
39 | - /** @var ILogger */ |
|
40 | - private $logger; |
|
39 | + /** @var ILogger */ |
|
40 | + private $logger; |
|
41 | 41 | |
42 | - /** @var WeatherStatusService */ |
|
43 | - private $service; |
|
42 | + /** @var WeatherStatusService */ |
|
43 | + private $service; |
|
44 | 44 | |
45 | - public function __construct(string $appName, |
|
46 | - IRequest $request, |
|
47 | - ILogger $logger, |
|
48 | - WeatherStatusService $service, |
|
49 | - ?string $userId) { |
|
50 | - parent::__construct($appName, $request); |
|
51 | - $this->userId = $userId; |
|
52 | - $this->logger = $logger; |
|
53 | - $this->service = $service; |
|
54 | - } |
|
45 | + public function __construct(string $appName, |
|
46 | + IRequest $request, |
|
47 | + ILogger $logger, |
|
48 | + WeatherStatusService $service, |
|
49 | + ?string $userId) { |
|
50 | + parent::__construct($appName, $request); |
|
51 | + $this->userId = $userId; |
|
52 | + $this->logger = $logger; |
|
53 | + $this->service = $service; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @NoAdminRequired |
|
58 | - * |
|
59 | - * Try to use the address set in user personal settings as weather location |
|
60 | - * |
|
61 | - * @return DataResponse with success state and address information |
|
62 | - */ |
|
63 | - public function usePersonalAddress(): DataResponse { |
|
64 | - return new DataResponse($this->service->usePersonalAddress()); |
|
65 | - } |
|
56 | + /** |
|
57 | + * @NoAdminRequired |
|
58 | + * |
|
59 | + * Try to use the address set in user personal settings as weather location |
|
60 | + * |
|
61 | + * @return DataResponse with success state and address information |
|
62 | + */ |
|
63 | + public function usePersonalAddress(): DataResponse { |
|
64 | + return new DataResponse($this->service->usePersonalAddress()); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * @NoAdminRequired |
|
69 | - * |
|
70 | - * Change the weather status mode. There are currently 2 modes: |
|
71 | - * - ask the browser |
|
72 | - * - use the user defined address |
|
73 | - * |
|
74 | - * @param int $mode New mode |
|
75 | - * @return DataResponse success state |
|
76 | - */ |
|
77 | - public function setMode(int $mode): DataResponse { |
|
78 | - return new DataResponse($this->service->setMode($mode)); |
|
79 | - } |
|
67 | + /** |
|
68 | + * @NoAdminRequired |
|
69 | + * |
|
70 | + * Change the weather status mode. There are currently 2 modes: |
|
71 | + * - ask the browser |
|
72 | + * - use the user defined address |
|
73 | + * |
|
74 | + * @param int $mode New mode |
|
75 | + * @return DataResponse success state |
|
76 | + */ |
|
77 | + public function setMode(int $mode): DataResponse { |
|
78 | + return new DataResponse($this->service->setMode($mode)); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @NoAdminRequired |
|
83 | - * |
|
84 | - * Set address and resolve it to get coordinates |
|
85 | - * or directly set coordinates and get address with reverse geocoding |
|
86 | - * |
|
87 | - * @param string|null $address Any approximative or exact address |
|
88 | - * @param float|null $lat Latitude in decimal degree format |
|
89 | - * @param float|null $lon Longitude in decimal degree format |
|
90 | - * @return DataResponse with success state and address information |
|
91 | - */ |
|
92 | - public function setLocation(?string $address, ?float $lat, ?float $lon): DataResponse { |
|
93 | - $currentWeather = $this->service->setLocation($address, $lat, $lon); |
|
94 | - return new DataResponse($currentWeather); |
|
95 | - } |
|
81 | + /** |
|
82 | + * @NoAdminRequired |
|
83 | + * |
|
84 | + * Set address and resolve it to get coordinates |
|
85 | + * or directly set coordinates and get address with reverse geocoding |
|
86 | + * |
|
87 | + * @param string|null $address Any approximative or exact address |
|
88 | + * @param float|null $lat Latitude in decimal degree format |
|
89 | + * @param float|null $lon Longitude in decimal degree format |
|
90 | + * @return DataResponse with success state and address information |
|
91 | + */ |
|
92 | + public function setLocation(?string $address, ?float $lat, ?float $lon): DataResponse { |
|
93 | + $currentWeather = $this->service->setLocation($address, $lat, $lon); |
|
94 | + return new DataResponse($currentWeather); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * @NoAdminRequired |
|
99 | - * |
|
100 | - * Get stored user location |
|
101 | - * |
|
102 | - * @return DataResponse which contains coordinates, formatted address and current weather status mode |
|
103 | - */ |
|
104 | - public function getLocation(): DataResponse { |
|
105 | - $location = $this->service->getLocation(); |
|
106 | - return new DataResponse($location); |
|
107 | - } |
|
97 | + /** |
|
98 | + * @NoAdminRequired |
|
99 | + * |
|
100 | + * Get stored user location |
|
101 | + * |
|
102 | + * @return DataResponse which contains coordinates, formatted address and current weather status mode |
|
103 | + */ |
|
104 | + public function getLocation(): DataResponse { |
|
105 | + $location = $this->service->getLocation(); |
|
106 | + return new DataResponse($location); |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * @NoAdminRequired |
|
111 | - * |
|
112 | - * Get forecast for current location |
|
113 | - * |
|
114 | - * @return DataResponse which contains success state and filtered forecast data |
|
115 | - */ |
|
116 | - public function getForecast(): DataResponse { |
|
117 | - $forecast = $this->service->getForecast(); |
|
118 | - if (isset($forecast['success']) && $forecast['success'] === false) { |
|
119 | - return new DataResponse($forecast, Http::STATUS_NOT_FOUND); |
|
120 | - } else { |
|
121 | - return new DataResponse($forecast); |
|
122 | - } |
|
123 | - } |
|
109 | + /** |
|
110 | + * @NoAdminRequired |
|
111 | + * |
|
112 | + * Get forecast for current location |
|
113 | + * |
|
114 | + * @return DataResponse which contains success state and filtered forecast data |
|
115 | + */ |
|
116 | + public function getForecast(): DataResponse { |
|
117 | + $forecast = $this->service->getForecast(); |
|
118 | + if (isset($forecast['success']) && $forecast['success'] === false) { |
|
119 | + return new DataResponse($forecast, Http::STATUS_NOT_FOUND); |
|
120 | + } else { |
|
121 | + return new DataResponse($forecast); |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | - /** |
|
126 | - * @NoAdminRequired |
|
127 | - * |
|
128 | - * Get favorites list |
|
129 | - * |
|
130 | - * @return DataResponse which contains the favorite list |
|
131 | - */ |
|
132 | - public function getFavorites(): DataResponse { |
|
133 | - return new DataResponse($this->service->getFavorites()); |
|
134 | - } |
|
125 | + /** |
|
126 | + * @NoAdminRequired |
|
127 | + * |
|
128 | + * Get favorites list |
|
129 | + * |
|
130 | + * @return DataResponse which contains the favorite list |
|
131 | + */ |
|
132 | + public function getFavorites(): DataResponse { |
|
133 | + return new DataResponse($this->service->getFavorites()); |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * @NoAdminRequired |
|
138 | - * |
|
139 | - * Set favorites list |
|
140 | - * |
|
141 | - * @param array $favorites |
|
142 | - * @return DataResponse success state |
|
143 | - */ |
|
144 | - public function setFavorites(array $favorites): DataResponse { |
|
145 | - return new DataResponse($this->service->setFavorites($favorites)); |
|
146 | - } |
|
136 | + /** |
|
137 | + * @NoAdminRequired |
|
138 | + * |
|
139 | + * Set favorites list |
|
140 | + * |
|
141 | + * @param array $favorites |
|
142 | + * @return DataResponse success state |
|
143 | + */ |
|
144 | + public function setFavorites(array $favorites): DataResponse { |
|
145 | + return new DataResponse($this->service->setFavorites($favorites)); |
|
146 | + } |
|
147 | 147 | } |
@@ -37,62 +37,62 @@ |
||
37 | 37 | use function in_array; |
38 | 38 | |
39 | 39 | class ShareInteractionListener implements IEventListener { |
40 | - private const SUPPORTED_SHARE_TYPES = [ |
|
41 | - IShare::TYPE_USER, |
|
42 | - IShare::TYPE_EMAIL, |
|
43 | - IShare::TYPE_REMOTE, |
|
44 | - ]; |
|
40 | + private const SUPPORTED_SHARE_TYPES = [ |
|
41 | + IShare::TYPE_USER, |
|
42 | + IShare::TYPE_EMAIL, |
|
43 | + IShare::TYPE_REMOTE, |
|
44 | + ]; |
|
45 | 45 | |
46 | - /** @var IEventDispatcher */ |
|
47 | - private $dispatcher; |
|
46 | + /** @var IEventDispatcher */ |
|
47 | + private $dispatcher; |
|
48 | 48 | |
49 | - /** @var IUserManager */ |
|
50 | - private $userManager; |
|
49 | + /** @var IUserManager */ |
|
50 | + private $userManager; |
|
51 | 51 | |
52 | - /** @var ILogger */ |
|
53 | - private $logger; |
|
52 | + /** @var ILogger */ |
|
53 | + private $logger; |
|
54 | 54 | |
55 | - public function __construct(IEventDispatcher $dispatcher, |
|
56 | - IUserManager $userManager, |
|
57 | - ILogger $logger) { |
|
58 | - $this->dispatcher = $dispatcher; |
|
59 | - $this->userManager = $userManager; |
|
60 | - $this->logger = $logger; |
|
61 | - } |
|
55 | + public function __construct(IEventDispatcher $dispatcher, |
|
56 | + IUserManager $userManager, |
|
57 | + ILogger $logger) { |
|
58 | + $this->dispatcher = $dispatcher; |
|
59 | + $this->userManager = $userManager; |
|
60 | + $this->logger = $logger; |
|
61 | + } |
|
62 | 62 | |
63 | - public function handle(Event $event): void { |
|
64 | - if (!($event instanceof ShareCreatedEvent)) { |
|
65 | - // Unrelated |
|
66 | - return; |
|
67 | - } |
|
63 | + public function handle(Event $event): void { |
|
64 | + if (!($event instanceof ShareCreatedEvent)) { |
|
65 | + // Unrelated |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - $share = $event->getShare(); |
|
70 | - if (!in_array($share->getShareType(), self::SUPPORTED_SHARE_TYPES, true)) { |
|
71 | - $this->logger->debug('Share type does not allow to emit interaction event'); |
|
72 | - return; |
|
73 | - } |
|
74 | - $actor = $this->userManager->get($share->getSharedBy()); |
|
75 | - $sharedWith = $this->userManager->get($share->getSharedWith()); |
|
76 | - if ($actor === null) { |
|
77 | - $this->logger->warning('Share was not created by a user, can\'t emit interaction event'); |
|
78 | - return; |
|
79 | - } |
|
80 | - $interactionEvent = new ContactInteractedWithEvent($actor); |
|
81 | - switch ($share->getShareType()) { |
|
82 | - case IShare::TYPE_USER: |
|
83 | - $interactionEvent->setUid($share->getSharedWith()); |
|
84 | - if ($sharedWith !== null) { |
|
85 | - $interactionEvent->setFederatedCloudId($sharedWith->getCloudId()); |
|
86 | - } |
|
87 | - break; |
|
88 | - case IShare::TYPE_EMAIL: |
|
89 | - $interactionEvent->setEmail($share->getSharedWith()); |
|
90 | - break; |
|
91 | - case IShare::TYPE_REMOTE: |
|
92 | - $interactionEvent->setFederatedCloudId($share->getSharedWith()); |
|
93 | - break; |
|
94 | - } |
|
69 | + $share = $event->getShare(); |
|
70 | + if (!in_array($share->getShareType(), self::SUPPORTED_SHARE_TYPES, true)) { |
|
71 | + $this->logger->debug('Share type does not allow to emit interaction event'); |
|
72 | + return; |
|
73 | + } |
|
74 | + $actor = $this->userManager->get($share->getSharedBy()); |
|
75 | + $sharedWith = $this->userManager->get($share->getSharedWith()); |
|
76 | + if ($actor === null) { |
|
77 | + $this->logger->warning('Share was not created by a user, can\'t emit interaction event'); |
|
78 | + return; |
|
79 | + } |
|
80 | + $interactionEvent = new ContactInteractedWithEvent($actor); |
|
81 | + switch ($share->getShareType()) { |
|
82 | + case IShare::TYPE_USER: |
|
83 | + $interactionEvent->setUid($share->getSharedWith()); |
|
84 | + if ($sharedWith !== null) { |
|
85 | + $interactionEvent->setFederatedCloudId($sharedWith->getCloudId()); |
|
86 | + } |
|
87 | + break; |
|
88 | + case IShare::TYPE_EMAIL: |
|
89 | + $interactionEvent->setEmail($share->getSharedWith()); |
|
90 | + break; |
|
91 | + case IShare::TYPE_REMOTE: |
|
92 | + $interactionEvent->setFederatedCloudId($share->getSharedWith()); |
|
93 | + break; |
|
94 | + } |
|
95 | 95 | |
96 | - $this->dispatcher->dispatchTyped($interactionEvent); |
|
97 | - } |
|
96 | + $this->dispatcher->dispatchTyped($interactionEvent); |
|
97 | + } |
|
98 | 98 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | use OCA\User_LDAP\Mapping\GroupMapping; |
31 | 31 | |
32 | 32 | class UUIDFixGroup extends UUIDFix { |
33 | - public function __construct(GroupMapping $mapper, Group_Proxy $proxy) { |
|
34 | - $this->mapper = $mapper; |
|
35 | - $this->proxy = $proxy; |
|
36 | - } |
|
33 | + public function __construct(GroupMapping $mapper, Group_Proxy $proxy) { |
|
34 | + $this->mapper = $mapper; |
|
35 | + $this->proxy = $proxy; |
|
36 | + } |
|
37 | 37 | } |
@@ -30,24 +30,24 @@ |
||
30 | 30 | use OCA\User_LDAP\User_Proxy; |
31 | 31 | |
32 | 32 | abstract class UUIDFix extends QueuedJob { |
33 | - /** @var AbstractMapping */ |
|
34 | - protected $mapper; |
|
33 | + /** @var AbstractMapping */ |
|
34 | + protected $mapper; |
|
35 | 35 | |
36 | - /** @var Proxy */ |
|
37 | - protected $proxy; |
|
36 | + /** @var Proxy */ |
|
37 | + protected $proxy; |
|
38 | 38 | |
39 | - public function run($argument) { |
|
40 | - $isUser = $this->proxy instanceof User_Proxy; |
|
41 | - foreach ($argument['records'] as $record) { |
|
42 | - $access = $this->proxy->getLDAPAccess($record['name']); |
|
43 | - $uuid = $access->getUUID($record['dn'], $isUser); |
|
44 | - if ($uuid === false) { |
|
45 | - // record not found, no prob, continue with the next |
|
46 | - continue; |
|
47 | - } |
|
48 | - if ($uuid !== $record['uuid']) { |
|
49 | - $this->mapper->setUUIDbyDN($uuid, $record['dn']); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
39 | + public function run($argument) { |
|
40 | + $isUser = $this->proxy instanceof User_Proxy; |
|
41 | + foreach ($argument['records'] as $record) { |
|
42 | + $access = $this->proxy->getLDAPAccess($record['name']); |
|
43 | + $uuid = $access->getUUID($record['dn'], $isUser); |
|
44 | + if ($uuid === false) { |
|
45 | + // record not found, no prob, continue with the next |
|
46 | + continue; |
|
47 | + } |
|
48 | + if ($uuid !== $record['uuid']) { |
|
49 | + $this->mapper->setUUIDbyDN($uuid, $record['dn']); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | use OCA\User_LDAP\Mapping\UserMapping; |
31 | 31 | |
32 | 32 | class UUIDFixUser extends UUIDFix { |
33 | - public function __construct(UserMapping $mapper, User_Proxy $proxy) { |
|
34 | - $this->mapper = $mapper; |
|
35 | - $this->proxy = $proxy; |
|
36 | - } |
|
33 | + public function __construct(UserMapping $mapper, User_Proxy $proxy) { |
|
34 | + $this->mapper = $mapper; |
|
35 | + $this->proxy = $proxy; |
|
36 | + } |
|
37 | 37 | } |
@@ -33,82 +33,82 @@ |
||
33 | 33 | * @package OCA\User_LDAP |
34 | 34 | */ |
35 | 35 | class DeletedUsersIndex { |
36 | - /** |
|
37 | - * @var \OCP\IConfig $config |
|
38 | - */ |
|
39 | - protected $config; |
|
36 | + /** |
|
37 | + * @var \OCP\IConfig $config |
|
38 | + */ |
|
39 | + protected $config; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var \OCA\User_LDAP\Mapping\UserMapping $mapping |
|
43 | - */ |
|
44 | - protected $mapping; |
|
41 | + /** |
|
42 | + * @var \OCA\User_LDAP\Mapping\UserMapping $mapping |
|
43 | + */ |
|
44 | + protected $mapping; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var array $deletedUsers |
|
48 | - */ |
|
49 | - protected $deletedUsers; |
|
50 | - /** @var IManager */ |
|
51 | - private $shareManager; |
|
46 | + /** |
|
47 | + * @var array $deletedUsers |
|
48 | + */ |
|
49 | + protected $deletedUsers; |
|
50 | + /** @var IManager */ |
|
51 | + private $shareManager; |
|
52 | 52 | |
53 | - public function __construct(\OCP\IConfig $config, UserMapping $mapping, IManager $shareManager) { |
|
54 | - $this->config = $config; |
|
55 | - $this->mapping = $mapping; |
|
56 | - $this->shareManager = $shareManager; |
|
57 | - } |
|
53 | + public function __construct(\OCP\IConfig $config, UserMapping $mapping, IManager $shareManager) { |
|
54 | + $this->config = $config; |
|
55 | + $this->mapping = $mapping; |
|
56 | + $this->shareManager = $shareManager; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * reads LDAP users marked as deleted from the database |
|
61 | - * @return \OCA\User_LDAP\User\OfflineUser[] |
|
62 | - */ |
|
63 | - private function fetchDeletedUsers() { |
|
64 | - $deletedUsers = $this->config->getUsersForUserValue( |
|
65 | - 'user_ldap', 'isDeleted', '1'); |
|
59 | + /** |
|
60 | + * reads LDAP users marked as deleted from the database |
|
61 | + * @return \OCA\User_LDAP\User\OfflineUser[] |
|
62 | + */ |
|
63 | + private function fetchDeletedUsers() { |
|
64 | + $deletedUsers = $this->config->getUsersForUserValue( |
|
65 | + 'user_ldap', 'isDeleted', '1'); |
|
66 | 66 | |
67 | - $userObjects = []; |
|
68 | - foreach ($deletedUsers as $user) { |
|
69 | - $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager); |
|
70 | - } |
|
71 | - $this->deletedUsers = $userObjects; |
|
67 | + $userObjects = []; |
|
68 | + foreach ($deletedUsers as $user) { |
|
69 | + $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager); |
|
70 | + } |
|
71 | + $this->deletedUsers = $userObjects; |
|
72 | 72 | |
73 | - return $this->deletedUsers; |
|
74 | - } |
|
73 | + return $this->deletedUsers; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * returns all LDAP users that are marked as deleted |
|
78 | - * @return \OCA\User_LDAP\User\OfflineUser[] |
|
79 | - */ |
|
80 | - public function getUsers() { |
|
81 | - if (is_array($this->deletedUsers)) { |
|
82 | - return $this->deletedUsers; |
|
83 | - } |
|
84 | - return $this->fetchDeletedUsers(); |
|
85 | - } |
|
76 | + /** |
|
77 | + * returns all LDAP users that are marked as deleted |
|
78 | + * @return \OCA\User_LDAP\User\OfflineUser[] |
|
79 | + */ |
|
80 | + public function getUsers() { |
|
81 | + if (is_array($this->deletedUsers)) { |
|
82 | + return $this->deletedUsers; |
|
83 | + } |
|
84 | + return $this->fetchDeletedUsers(); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * whether at least one user was detected as deleted |
|
89 | - * @return bool |
|
90 | - */ |
|
91 | - public function hasUsers() { |
|
92 | - if (!is_array($this->deletedUsers)) { |
|
93 | - $this->fetchDeletedUsers(); |
|
94 | - } |
|
95 | - return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
|
96 | - } |
|
87 | + /** |
|
88 | + * whether at least one user was detected as deleted |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function hasUsers() { |
|
92 | + if (!is_array($this->deletedUsers)) { |
|
93 | + $this->fetchDeletedUsers(); |
|
94 | + } |
|
95 | + return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * marks a user as deleted |
|
100 | - * |
|
101 | - * @param string $ocName |
|
102 | - * @throws \OCP\PreConditionNotMetException |
|
103 | - */ |
|
104 | - public function markUser($ocName) { |
|
105 | - $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
|
106 | - if ($curValue === '1') { |
|
107 | - // the user is already marked, do not write to DB again |
|
108 | - return; |
|
109 | - } |
|
110 | - $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
|
111 | - $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
112 | - $this->deletedUsers = null; |
|
113 | - } |
|
98 | + /** |
|
99 | + * marks a user as deleted |
|
100 | + * |
|
101 | + * @param string $ocName |
|
102 | + * @throws \OCP\PreConditionNotMetException |
|
103 | + */ |
|
104 | + public function markUser($ocName) { |
|
105 | + $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
|
106 | + if ($curValue === '1') { |
|
107 | + // the user is already marked, do not write to DB again |
|
108 | + return; |
|
109 | + } |
|
110 | + $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
|
111 | + $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
112 | + $this->deletedUsers = null; |
|
113 | + } |
|
114 | 114 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | * @since 9.1.0 |
33 | 33 | */ |
34 | 34 | interface INotifyStorage { |
35 | - public const NOTIFY_ADDED = 1; |
|
36 | - public const NOTIFY_REMOVED = 2; |
|
37 | - public const NOTIFY_MODIFIED = 3; |
|
38 | - public const NOTIFY_RENAMED = 4; |
|
35 | + public const NOTIFY_ADDED = 1; |
|
36 | + public const NOTIFY_REMOVED = 2; |
|
37 | + public const NOTIFY_MODIFIED = 3; |
|
38 | + public const NOTIFY_RENAMED = 4; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Start the notification handler for this storage |
|
42 | - * |
|
43 | - * @param $path |
|
44 | - * @return INotifyHandler |
|
45 | - * |
|
46 | - * @since 12.0.0 |
|
47 | - */ |
|
48 | - public function notify($path); |
|
40 | + /** |
|
41 | + * Start the notification handler for this storage |
|
42 | + * |
|
43 | + * @param $path |
|
44 | + * @return INotifyHandler |
|
45 | + * |
|
46 | + * @since 12.0.0 |
|
47 | + */ |
|
48 | + public function notify($path); |
|
49 | 49 | } |