Passed
Push — master ( 59f0fc...5d097d )
by Blizzz
16:10 queued 12s
created
apps/files_sharing/lib/Listener/UserAddedToGroupListener.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -35,48 +35,48 @@
 block discarded – undo
35 35
 
36 36
 class UserAddedToGroupListener implements IEventListener {
37 37
 
38
-	/** @var IManager */
39
-	private $shareManager;
38
+    /** @var IManager */
39
+    private $shareManager;
40 40
 
41
-	/** @var IConfig */
42
-	private $config;
41
+    /** @var IConfig */
42
+    private $config;
43 43
 
44
-	public function __construct(IManager $shareManager, IConfig $config) {
45
-		$this->shareManager = $shareManager;
46
-		$this->config = $config;
47
-	}
44
+    public function __construct(IManager $shareManager, IConfig $config) {
45
+        $this->shareManager = $shareManager;
46
+        $this->config = $config;
47
+    }
48 48
 
49
-	public function handle(Event $event): void {
50
-		if (!($event instanceof UserAddedEvent)) {
51
-			return;
52
-		}
49
+    public function handle(Event $event): void {
50
+        if (!($event instanceof UserAddedEvent)) {
51
+            return;
52
+        }
53 53
 
54
-		$user = $event->getUser();
55
-		$group = $event->getGroup();
54
+        $user = $event->getUser();
55
+        $group = $event->getGroup();
56 56
 
57
-		// This user doesn't have autoaccept so we can skip it all
58
-		if (!$this->hasAutoAccept($user->getUID())) {
59
-			return;
60
-		}
57
+        // This user doesn't have autoaccept so we can skip it all
58
+        if (!$this->hasAutoAccept($user->getUID())) {
59
+            return;
60
+        }
61 61
 
62
-		// Get all group shares this user has access to now to filter later
63
-		$shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, -1);
62
+        // Get all group shares this user has access to now to filter later
63
+        $shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, -1);
64 64
 
65
-		foreach ($shares as $share) {
66
-			// If this is not the new group we can skip it
67
-			if ($share->getSharedWith() !== $group->getGID()) {
68
-				continue;
69
-			}
65
+        foreach ($shares as $share) {
66
+            // If this is not the new group we can skip it
67
+            if ($share->getSharedWith() !== $group->getGID()) {
68
+                continue;
69
+            }
70 70
 
71
-			// Accept the share if needed
72
-			$this->shareManager->acceptShare($share, $user->getUID());
73
-		}
74
-	}
71
+            // Accept the share if needed
72
+            $this->shareManager->acceptShare($share, $user->getUID());
73
+        }
74
+    }
75 75
 
76 76
 
77
-	private function hasAutoAccept(string $userId): bool {
78
-		$defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
79
-		$acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
80
-		return (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault);
81
-	}
77
+    private function hasAutoAccept(string $userId): bool {
78
+        $defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
79
+        $acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
80
+        return (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault);
81
+    }
82 82
 }
Please login to merge, or discard this patch.