@@ -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 | } |
@@ -25,24 +25,24 @@ |
||
25 | 25 | |
26 | 26 | class Hooks { |
27 | 27 | |
28 | - /** @var TrustedServers */ |
|
29 | - private $trustedServers; |
|
28 | + /** @var TrustedServers */ |
|
29 | + private $trustedServers; |
|
30 | 30 | |
31 | - public function __construct(TrustedServers $trustedServers) { |
|
32 | - $this->trustedServers = $trustedServers; |
|
33 | - } |
|
31 | + public function __construct(TrustedServers $trustedServers) { |
|
32 | + $this->trustedServers = $trustedServers; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * add servers to the list of trusted servers once a federated share was established |
|
37 | - * |
|
38 | - * @param array $params |
|
39 | - */ |
|
40 | - public function addServerHook($params) { |
|
41 | - if ( |
|
42 | - $this->trustedServers->getAutoAddServers() === true && |
|
43 | - $this->trustedServers->isTrustedServer($params['server']) === false |
|
44 | - ) { |
|
45 | - $this->trustedServers->addServer($params['server']); |
|
46 | - } |
|
47 | - } |
|
35 | + /** |
|
36 | + * add servers to the list of trusted servers once a federated share was established |
|
37 | + * |
|
38 | + * @param array $params |
|
39 | + */ |
|
40 | + public function addServerHook($params) { |
|
41 | + if ( |
|
42 | + $this->trustedServers->getAutoAddServers() === true && |
|
43 | + $this->trustedServers->isTrustedServer($params['server']) === false |
|
44 | + ) { |
|
45 | + $this->trustedServers->addServer($params['server']); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | } |
@@ -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 | } |
@@ -31,30 +31,30 @@ |
||
31 | 31 | use OCP\Command\ICommand; |
32 | 32 | |
33 | 33 | class Expire implements ICommand { |
34 | - use FileAccess; |
|
34 | + use FileAccess; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private $user; |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private $user; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param string $user |
|
43 | - */ |
|
44 | - public function __construct($user) { |
|
45 | - $this->user = $user; |
|
46 | - } |
|
41 | + /** |
|
42 | + * @param string $user |
|
43 | + */ |
|
44 | + public function __construct($user) { |
|
45 | + $this->user = $user; |
|
46 | + } |
|
47 | 47 | |
48 | - public function handle() { |
|
49 | - $userManager = \OC::$server->getUserManager(); |
|
50 | - if (!$userManager->userExists($this->user)) { |
|
51 | - // User has been deleted already |
|
52 | - return; |
|
53 | - } |
|
48 | + public function handle() { |
|
49 | + $userManager = \OC::$server->getUserManager(); |
|
50 | + if (!$userManager->userExists($this->user)) { |
|
51 | + // User has been deleted already |
|
52 | + return; |
|
53 | + } |
|
54 | 54 | |
55 | - \OC_Util::tearDownFS(); |
|
56 | - \OC_Util::setupFS($this->user); |
|
57 | - Trashbin::expire($this->user); |
|
58 | - \OC_Util::tearDownFS(); |
|
59 | - } |
|
55 | + \OC_Util::tearDownFS(); |
|
56 | + \OC_Util::setupFS($this->user); |
|
57 | + Trashbin::expire($this->user); |
|
58 | + \OC_Util::tearDownFS(); |
|
59 | + } |
|
60 | 60 | } |
@@ -27,91 +27,91 @@ |
||
27 | 27 | use OCP\Notification\IManager; |
28 | 28 | |
29 | 29 | class Listener { |
30 | - /** @var IManager */ |
|
31 | - protected $notificationManager; |
|
30 | + /** @var IManager */ |
|
31 | + protected $notificationManager; |
|
32 | 32 | |
33 | - /** @var IUserManager */ |
|
34 | - protected $userManager; |
|
33 | + /** @var IUserManager */ |
|
34 | + protected $userManager; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Listener constructor. |
|
38 | - * |
|
39 | - * @param IManager $notificationManager |
|
40 | - * @param IUserManager $userManager |
|
41 | - */ |
|
42 | - public function __construct( |
|
43 | - IManager $notificationManager, |
|
44 | - IUserManager $userManager |
|
45 | - ) { |
|
46 | - $this->notificationManager = $notificationManager; |
|
47 | - $this->userManager = $userManager; |
|
48 | - } |
|
36 | + /** |
|
37 | + * Listener constructor. |
|
38 | + * |
|
39 | + * @param IManager $notificationManager |
|
40 | + * @param IUserManager $userManager |
|
41 | + */ |
|
42 | + public function __construct( |
|
43 | + IManager $notificationManager, |
|
44 | + IUserManager $userManager |
|
45 | + ) { |
|
46 | + $this->notificationManager = $notificationManager; |
|
47 | + $this->userManager = $userManager; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param CommentsEvent $event |
|
52 | - */ |
|
53 | - public function evaluate(CommentsEvent $event) { |
|
54 | - $comment = $event->getComment(); |
|
50 | + /** |
|
51 | + * @param CommentsEvent $event |
|
52 | + */ |
|
53 | + public function evaluate(CommentsEvent $event) { |
|
54 | + $comment = $event->getComment(); |
|
55 | 55 | |
56 | - $mentions = $this->extractMentions($comment->getMentions()); |
|
57 | - if (empty($mentions)) { |
|
58 | - // no one to notify |
|
59 | - return; |
|
60 | - } |
|
56 | + $mentions = $this->extractMentions($comment->getMentions()); |
|
57 | + if (empty($mentions)) { |
|
58 | + // no one to notify |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - $notification = $this->instantiateNotification($comment); |
|
62 | + $notification = $this->instantiateNotification($comment); |
|
63 | 63 | |
64 | - foreach ($mentions as $uid) { |
|
65 | - if (($comment->getActorType() === 'users' && $uid === $comment->getActorId()) |
|
66 | - || !$this->userManager->userExists($uid) |
|
67 | - ) { |
|
68 | - // do not notify unknown users or yourself |
|
69 | - continue; |
|
70 | - } |
|
64 | + foreach ($mentions as $uid) { |
|
65 | + if (($comment->getActorType() === 'users' && $uid === $comment->getActorId()) |
|
66 | + || !$this->userManager->userExists($uid) |
|
67 | + ) { |
|
68 | + // do not notify unknown users or yourself |
|
69 | + continue; |
|
70 | + } |
|
71 | 71 | |
72 | - $notification->setUser($uid); |
|
73 | - if ($event->getEvent() === CommentsEvent::EVENT_DELETE |
|
74 | - || $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) { |
|
75 | - $this->notificationManager->markProcessed($notification); |
|
76 | - } else { |
|
77 | - $this->notificationManager->notify($notification); |
|
78 | - } |
|
79 | - } |
|
80 | - } |
|
72 | + $notification->setUser($uid); |
|
73 | + if ($event->getEvent() === CommentsEvent::EVENT_DELETE |
|
74 | + || $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) { |
|
75 | + $this->notificationManager->markProcessed($notification); |
|
76 | + } else { |
|
77 | + $this->notificationManager->notify($notification); |
|
78 | + } |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * creates a notification instance and fills it with comment data |
|
84 | - * |
|
85 | - * @param IComment $comment |
|
86 | - * @return \OCP\Notification\INotification |
|
87 | - */ |
|
88 | - public function instantiateNotification(IComment $comment) { |
|
89 | - $notification = $this->notificationManager->createNotification(); |
|
90 | - $notification |
|
91 | - ->setApp('comments') |
|
92 | - ->setObject('comment', $comment->getId()) |
|
93 | - ->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ]) |
|
94 | - ->setDateTime($comment->getCreationDateTime()); |
|
82 | + /** |
|
83 | + * creates a notification instance and fills it with comment data |
|
84 | + * |
|
85 | + * @param IComment $comment |
|
86 | + * @return \OCP\Notification\INotification |
|
87 | + */ |
|
88 | + public function instantiateNotification(IComment $comment) { |
|
89 | + $notification = $this->notificationManager->createNotification(); |
|
90 | + $notification |
|
91 | + ->setApp('comments') |
|
92 | + ->setObject('comment', $comment->getId()) |
|
93 | + ->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ]) |
|
94 | + ->setDateTime($comment->getCreationDateTime()); |
|
95 | 95 | |
96 | - return $notification; |
|
97 | - } |
|
96 | + return $notification; |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * flattens the mention array returned from comments to a list of user ids. |
|
101 | - * |
|
102 | - * @param array $mentions |
|
103 | - * @return string[] containing the mentions, e.g. ['alice', 'bob'] |
|
104 | - */ |
|
105 | - public function extractMentions(array $mentions) { |
|
106 | - if (empty($mentions)) { |
|
107 | - return []; |
|
108 | - } |
|
109 | - $uids = []; |
|
110 | - foreach ($mentions as $mention) { |
|
111 | - if ($mention['type'] === 'user') { |
|
112 | - $uids[] = $mention['id']; |
|
113 | - } |
|
114 | - } |
|
115 | - return $uids; |
|
116 | - } |
|
99 | + /** |
|
100 | + * flattens the mention array returned from comments to a list of user ids. |
|
101 | + * |
|
102 | + * @param array $mentions |
|
103 | + * @return string[] containing the mentions, e.g. ['alice', 'bob'] |
|
104 | + */ |
|
105 | + public function extractMentions(array $mentions) { |
|
106 | + if (empty($mentions)) { |
|
107 | + return []; |
|
108 | + } |
|
109 | + $uids = []; |
|
110 | + foreach ($mentions as $mention) { |
|
111 | + if ($mention['type'] === 'user') { |
|
112 | + $uids[] = $mention['id']; |
|
113 | + } |
|
114 | + } |
|
115 | + return $uids; |
|
116 | + } |
|
117 | 117 | } |
@@ -36,56 +36,56 @@ |
||
36 | 36 | * @package OCA\Comments |
37 | 37 | */ |
38 | 38 | class EventHandler implements ICommentsEventHandler { |
39 | - /** @var ActivityListener */ |
|
40 | - private $activityListener; |
|
39 | + /** @var ActivityListener */ |
|
40 | + private $activityListener; |
|
41 | 41 | |
42 | - /** @var NotificationListener */ |
|
43 | - private $notificationListener; |
|
42 | + /** @var NotificationListener */ |
|
43 | + private $notificationListener; |
|
44 | 44 | |
45 | - public function __construct(ActivityListener $activityListener, NotificationListener $notificationListener) { |
|
46 | - $this->activityListener = $activityListener; |
|
47 | - $this->notificationListener = $notificationListener; |
|
48 | - } |
|
45 | + public function __construct(ActivityListener $activityListener, NotificationListener $notificationListener) { |
|
46 | + $this->activityListener = $activityListener; |
|
47 | + $this->notificationListener = $notificationListener; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param CommentsEvent $event |
|
52 | - */ |
|
53 | - public function handle(CommentsEvent $event) { |
|
54 | - if ($event->getComment()->getObjectType() !== 'files') { |
|
55 | - // this is a 'files'-specific Handler |
|
56 | - return; |
|
57 | - } |
|
50 | + /** |
|
51 | + * @param CommentsEvent $event |
|
52 | + */ |
|
53 | + public function handle(CommentsEvent $event) { |
|
54 | + if ($event->getComment()->getObjectType() !== 'files') { |
|
55 | + // this is a 'files'-specific Handler |
|
56 | + return; |
|
57 | + } |
|
58 | 58 | |
59 | - $eventType = $event->getEvent(); |
|
60 | - if ($eventType === CommentsEvent::EVENT_ADD |
|
61 | - ) { |
|
62 | - $this->notificationHandler($event); |
|
63 | - $this->activityHandler($event); |
|
64 | - return; |
|
65 | - } |
|
59 | + $eventType = $event->getEvent(); |
|
60 | + if ($eventType === CommentsEvent::EVENT_ADD |
|
61 | + ) { |
|
62 | + $this->notificationHandler($event); |
|
63 | + $this->activityHandler($event); |
|
64 | + return; |
|
65 | + } |
|
66 | 66 | |
67 | - $applicableEvents = [ |
|
68 | - CommentsEvent::EVENT_PRE_UPDATE, |
|
69 | - CommentsEvent::EVENT_UPDATE, |
|
70 | - CommentsEvent::EVENT_DELETE, |
|
71 | - ]; |
|
72 | - if (in_array($eventType, $applicableEvents)) { |
|
73 | - $this->notificationHandler($event); |
|
74 | - return; |
|
75 | - } |
|
76 | - } |
|
67 | + $applicableEvents = [ |
|
68 | + CommentsEvent::EVENT_PRE_UPDATE, |
|
69 | + CommentsEvent::EVENT_UPDATE, |
|
70 | + CommentsEvent::EVENT_DELETE, |
|
71 | + ]; |
|
72 | + if (in_array($eventType, $applicableEvents)) { |
|
73 | + $this->notificationHandler($event); |
|
74 | + return; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param CommentsEvent $event |
|
80 | - */ |
|
81 | - private function activityHandler(CommentsEvent $event) { |
|
82 | - $this->activityListener->commentEvent($event); |
|
83 | - } |
|
78 | + /** |
|
79 | + * @param CommentsEvent $event |
|
80 | + */ |
|
81 | + private function activityHandler(CommentsEvent $event) { |
|
82 | + $this->activityListener->commentEvent($event); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @param CommentsEvent $event |
|
87 | - */ |
|
88 | - private function notificationHandler(CommentsEvent $event) { |
|
89 | - $this->notificationListener->evaluate($event); |
|
90 | - } |
|
85 | + /** |
|
86 | + * @param CommentsEvent $event |
|
87 | + */ |
|
88 | + private function notificationHandler(CommentsEvent $event) { |
|
89 | + $this->notificationListener->evaluate($event); |
|
90 | + } |
|
91 | 91 | } |
@@ -26,13 +26,13 @@ |
||
26 | 26 | namespace OCA\User_LDAP; |
27 | 27 | |
28 | 28 | abstract class BackendUtility { |
29 | - protected $access; |
|
29 | + protected $access; |
|
30 | 30 | |
31 | - /** |
|
32 | - * constructor, make sure the subclasses call this one! |
|
33 | - * @param Access $access an instance of Access for LDAP interaction |
|
34 | - */ |
|
35 | - public function __construct(Access $access) { |
|
36 | - $this->access = $access; |
|
37 | - } |
|
31 | + /** |
|
32 | + * constructor, make sure the subclasses call this one! |
|
33 | + * @param Access $access an instance of Access for LDAP interaction |
|
34 | + */ |
|
35 | + public function __construct(Access $access) { |
|
36 | + $this->access = $access; |
|
37 | + } |
|
38 | 38 | } |