Completed
Pull Request — master (#4704)
by Lukas
23:52 queued 09:21
created
apps/oauth2/lib/Db/ClientMapper.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -27,64 +27,64 @@
 block discarded – undo
27 27
 
28 28
 class ClientMapper extends Mapper {
29 29
 
30
-	/**
31
-	 * @param IDBConnection $db
32
-	 */
33
-	public function __construct(IDBConnection $db) {
34
-		parent::__construct($db, 'oauth2_clients');
35
-	}
30
+    /**
31
+     * @param IDBConnection $db
32
+     */
33
+    public function __construct(IDBConnection $db) {
34
+        parent::__construct($db, 'oauth2_clients');
35
+    }
36 36
 
37
-	/**
38
-	 * @param string $clientIdentifier
39
-	 * @return Client
40
-	 */
41
-	public function getByIdentifier($clientIdentifier) {
42
-		$qb = $this->db->getQueryBuilder();
43
-		$qb
44
-			->select('*')
45
-			->from($this->tableName)
46
-			->where($qb->expr()->eq('client_identifier', $qb->createNamedParameter($clientIdentifier)));
47
-		$result = $qb->execute();
48
-		$row = $result->fetch();
49
-		$result->closeCursor();
37
+    /**
38
+     * @param string $clientIdentifier
39
+     * @return Client
40
+     */
41
+    public function getByIdentifier($clientIdentifier) {
42
+        $qb = $this->db->getQueryBuilder();
43
+        $qb
44
+            ->select('*')
45
+            ->from($this->tableName)
46
+            ->where($qb->expr()->eq('client_identifier', $qb->createNamedParameter($clientIdentifier)));
47
+        $result = $qb->execute();
48
+        $row = $result->fetch();
49
+        $result->closeCursor();
50 50
 
51
-		if (!is_array($row)) {
52
-			$row = [];
53
-		}
51
+        if (!is_array($row)) {
52
+            $row = [];
53
+        }
54 54
 
55
-		return Client::fromRow($row);
56
-	}
55
+        return Client::fromRow($row);
56
+    }
57 57
 
58
-	/**
59
-	 * @param string $uid internal uid of the client
60
-	 * @return Client
61
-	 */
62
-	public function getByUid($uid) {
63
-		$qb = $this->db->getQueryBuilder();
64
-		$qb
65
-			->select('*')
66
-			->from($this->tableName)
67
-			->where($qb->expr()->eq('id', $qb->createNamedParameter($uid, IQueryBuilder::PARAM_INT)));
68
-		$result = $qb->execute();
69
-		$row = $result->fetch();
70
-		$result->closeCursor();
58
+    /**
59
+     * @param string $uid internal uid of the client
60
+     * @return Client
61
+     */
62
+    public function getByUid($uid) {
63
+        $qb = $this->db->getQueryBuilder();
64
+        $qb
65
+            ->select('*')
66
+            ->from($this->tableName)
67
+            ->where($qb->expr()->eq('id', $qb->createNamedParameter($uid, IQueryBuilder::PARAM_INT)));
68
+        $result = $qb->execute();
69
+        $row = $result->fetch();
70
+        $result->closeCursor();
71 71
 
72
-		if (!is_array($row)) {
73
-			$row = [];
74
-		}
72
+        if (!is_array($row)) {
73
+            $row = [];
74
+        }
75 75
 
76
-		return Client::fromRow($row);
77
-	}
76
+        return Client::fromRow($row);
77
+    }
78 78
 
79
-	/**
80
-	 * @return Client[]
81
-	 */
82
-	public function getClients() {
83
-		$qb = $this->db->getQueryBuilder();
84
-		$qb
85
-			->select('*')
86
-			->from($this->tableName);
79
+    /**
80
+     * @return Client[]
81
+     */
82
+    public function getClients() {
83
+        $qb = $this->db->getQueryBuilder();
84
+        $qb
85
+            ->select('*')
86
+            ->from($this->tableName);
87 87
 
88
-		return $this->findEntities($qb->getSQL());
89
-	}
88
+        return $this->findEntities($qb->getSQL());
89
+    }
90 90
 }
Please login to merge, or discard this patch.
apps/oauth2/lib/Controller/SettingsController.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -31,64 +31,64 @@
 block discarded – undo
31 31
 use OCP\Security\ISecureRandom;
32 32
 
33 33
 class SettingsController extends Controller {
34
-	/** @var IURLGenerator */
35
-	private $urlGenerator;
36
-	/** @var ClientMapper */
37
-	private $clientMapper;
38
-	/** @var ISecureRandom */
39
-	private $secureRandom;
40
-	/** @var AccessTokenMapper  */
41
-	private $accessTokenMapper;
34
+    /** @var IURLGenerator */
35
+    private $urlGenerator;
36
+    /** @var ClientMapper */
37
+    private $clientMapper;
38
+    /** @var ISecureRandom */
39
+    private $secureRandom;
40
+    /** @var AccessTokenMapper  */
41
+    private $accessTokenMapper;
42 42
 
43
-	const validChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
43
+    const validChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
44 44
 
45
-	/**
46
-	 * @param string $appName
47
-	 * @param IRequest $request
48
-	 * @param IURLGenerator $urlGenerator
49
-	 * @param ClientMapper $clientMapper
50
-	 * @param ISecureRandom $secureRandom
51
-	 * @param AccessTokenMapper $accessTokenMapper
52
-	 */
53
-	public function __construct($appName,
54
-								IRequest $request,
55
-								IURLGenerator $urlGenerator,
56
-								ClientMapper $clientMapper,
57
-								ISecureRandom $secureRandom,
58
-								AccessTokenMapper $accessTokenMapper
59
-	) {
60
-		parent::__construct($appName, $request);
61
-		$this->urlGenerator = $urlGenerator;
62
-		$this->secureRandom = $secureRandom;
63
-		$this->clientMapper = $clientMapper;
64
-		$this->accessTokenMapper = $accessTokenMapper;
65
-	}
45
+    /**
46
+     * @param string $appName
47
+     * @param IRequest $request
48
+     * @param IURLGenerator $urlGenerator
49
+     * @param ClientMapper $clientMapper
50
+     * @param ISecureRandom $secureRandom
51
+     * @param AccessTokenMapper $accessTokenMapper
52
+     */
53
+    public function __construct($appName,
54
+                                IRequest $request,
55
+                                IURLGenerator $urlGenerator,
56
+                                ClientMapper $clientMapper,
57
+                                ISecureRandom $secureRandom,
58
+                                AccessTokenMapper $accessTokenMapper
59
+    ) {
60
+        parent::__construct($appName, $request);
61
+        $this->urlGenerator = $urlGenerator;
62
+        $this->secureRandom = $secureRandom;
63
+        $this->clientMapper = $clientMapper;
64
+        $this->accessTokenMapper = $accessTokenMapper;
65
+    }
66 66
 
67
-	/**
68
-	 * @param string $name
69
-	 * @param string $redirectUri
70
-	 * @return RedirectResponse
71
-	 */
72
-	public function addClient($name,
73
-							  $redirectUri) {
74
-		$client = new Client();
75
-		$client->setName($name);
76
-		$client->setRedirectUri($redirectUri);
77
-		$client->setSecret($this->secureRandom->generate(64, self::validChars));
78
-		$client->setClientIdentifier($this->secureRandom->generate(64, self::validChars));
79
-		$this->clientMapper->insert($client);
80
-		return new RedirectResponse($this->urlGenerator->getAbsoluteURL('/index.php/settings/admin/security'));
81
-	}
67
+    /**
68
+     * @param string $name
69
+     * @param string $redirectUri
70
+     * @return RedirectResponse
71
+     */
72
+    public function addClient($name,
73
+                                $redirectUri) {
74
+        $client = new Client();
75
+        $client->setName($name);
76
+        $client->setRedirectUri($redirectUri);
77
+        $client->setSecret($this->secureRandom->generate(64, self::validChars));
78
+        $client->setClientIdentifier($this->secureRandom->generate(64, self::validChars));
79
+        $this->clientMapper->insert($client);
80
+        return new RedirectResponse($this->urlGenerator->getAbsoluteURL('/index.php/settings/admin/security'));
81
+    }
82 82
 
83
-	/**
84
-	 * @param int $id
85
-	 * @return RedirectResponse
86
-	 */
87
-	public function deleteClient($id) {
88
-		$client = $this->clientMapper->getByUid($id);
89
-		$this->accessTokenMapper->deleteByClientId($id);
90
-		// ToDo delete from oc_authtoken all entries with name=$client->getName()
91
-		$this->clientMapper->delete($client);
92
-		return new RedirectResponse($this->urlGenerator->getAbsoluteURL('/index.php/settings/admin/security'));
93
-	}
83
+    /**
84
+     * @param int $id
85
+     * @return RedirectResponse
86
+     */
87
+    public function deleteClient($id) {
88
+        $client = $this->clientMapper->getByUid($id);
89
+        $this->accessTokenMapper->deleteByClientId($id);
90
+        // ToDo delete from oc_authtoken all entries with name=$client->getName()
91
+        $this->clientMapper->delete($client);
92
+        return new RedirectResponse($this->urlGenerator->getAbsoluteURL('/index.php/settings/admin/security'));
93
+    }
94 94
 }
Please login to merge, or discard this patch.