Code Duplication    Length = 11-13 lines in 3 locations

settings/Controller/UsersController.php 3 locations

@@ 498-508 (lines=11) @@
495
			);
496
		}
497
498
		if(!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) {
499
			return new DataResponse(
500
				[
501
					'status' => 'error',
502
					'data' => [
503
						'message' => (string)$this->l10n->t('Authentication error')
504
					]
505
				],
506
				Http::STATUS_FORBIDDEN
507
			);
508
		}
509
510
		if($user) {
511
			if($user->delete()) {
@@ 549-561 (lines=13) @@
546
		$userId = $this->userSession->getUser()->getUID();
547
		$user = $this->userManager->get($id);
548
549
		if($userId !== $id
550
			&& !$this->isAdmin
551
			&& !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) {
552
			return new DataResponse(
553
				[
554
					'status' => 'error',
555
					'data' => [
556
						'message' => (string)$this->l10n->t('Forbidden')
557
					]
558
				],
559
				Http::STATUS_FORBIDDEN
560
			);
561
		}
562
563
		if($mailAddress !== '' && !$this->mailer->validateMailAddress($mailAddress)) {
564
			return new DataResponse(
@@ 879-891 (lines=13) @@
876
                $userId = $this->userSession->getUser()->getUID();
877
                $user = $this->userManager->get($id);
878
879
                if($userId === $id ||
880
                        (!$this->isAdmin &&
881
                        !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user))) {
882
                        return new DataResponse(
883
                                array(
884
                                        'status' => 'error',
885
                                        'data' => array(
886
                                                'message' => (string)$this->l10n->t('Forbidden')
887
                                        )
888
                                ),
889
                                Http::STATUS_FORBIDDEN
890
                        );
891
                }
892
893
894
                if(!$user){