Passed
Push — master ( 970f39...e4f050 )
by Joas
15:13 queued 12s
created
lib/private/Authentication/Token/IToken.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -30,106 +30,106 @@
 block discarded – undo
30 30
 use JsonSerializable;
31 31
 
32 32
 interface IToken extends JsonSerializable {
33
-	public const TEMPORARY_TOKEN = 0;
34
-	public const PERMANENT_TOKEN = 1;
35
-	public const WIPE_TOKEN = 2;
36
-	public const DO_NOT_REMEMBER = 0;
37
-	public const REMEMBER = 1;
38
-
39
-	/**
40
-	 * Get the token ID
41
-	 *
42
-	 * @return int
43
-	 */
44
-	public function getId(): int;
45
-
46
-	/**
47
-	 * Get the user UID
48
-	 *
49
-	 * @return string
50
-	 */
51
-	public function getUID(): string;
52
-
53
-	/**
54
-	 * Get the login name used when generating the token
55
-	 *
56
-	 * @return string
57
-	 */
58
-	public function getLoginName(): string;
59
-
60
-	/**
61
-	 * Get the (encrypted) login password
62
-	 *
63
-	 * @return string|null
64
-	 */
65
-	public function getPassword();
66
-
67
-	/**
68
-	 * Get the timestamp of the last password check
69
-	 *
70
-	 * @return int
71
-	 */
72
-	public function getLastCheck(): int;
73
-
74
-	/**
75
-	 * Set the timestamp of the last password check
76
-	 *
77
-	 * @param int $time
78
-	 */
79
-	public function setLastCheck(int $time);
80
-
81
-	/**
82
-	 * Get the authentication scope for this token
83
-	 *
84
-	 * @return string
85
-	 */
86
-	public function getScope(): string;
87
-
88
-	/**
89
-	 * Get the authentication scope for this token
90
-	 *
91
-	 * @return array
92
-	 */
93
-	public function getScopeAsArray(): array;
94
-
95
-	/**
96
-	 * Set the authentication scope for this token
97
-	 *
98
-	 * @param array $scope
99
-	 */
100
-	public function setScope($scope);
101
-
102
-	/**
103
-	 * Get the name of the token
104
-	 * @return string
105
-	 */
106
-	public function getName(): string;
107
-
108
-	/**
109
-	 * Get the remember state of the token
110
-	 *
111
-	 * @return int
112
-	 */
113
-	public function getRemember(): int;
114
-
115
-	/**
116
-	 * Set the token
117
-	 *
118
-	 * @param string $token
119
-	 */
120
-	public function setToken(string $token);
121
-
122
-	/**
123
-	 * Set the password
124
-	 *
125
-	 * @param string $password
126
-	 */
127
-	public function setPassword(string $password);
128
-
129
-	/**
130
-	 * Set the expiration time of the token
131
-	 *
132
-	 * @param int|null $expires
133
-	 */
134
-	public function setExpires($expires);
33
+    public const TEMPORARY_TOKEN = 0;
34
+    public const PERMANENT_TOKEN = 1;
35
+    public const WIPE_TOKEN = 2;
36
+    public const DO_NOT_REMEMBER = 0;
37
+    public const REMEMBER = 1;
38
+
39
+    /**
40
+     * Get the token ID
41
+     *
42
+     * @return int
43
+     */
44
+    public function getId(): int;
45
+
46
+    /**
47
+     * Get the user UID
48
+     *
49
+     * @return string
50
+     */
51
+    public function getUID(): string;
52
+
53
+    /**
54
+     * Get the login name used when generating the token
55
+     *
56
+     * @return string
57
+     */
58
+    public function getLoginName(): string;
59
+
60
+    /**
61
+     * Get the (encrypted) login password
62
+     *
63
+     * @return string|null
64
+     */
65
+    public function getPassword();
66
+
67
+    /**
68
+     * Get the timestamp of the last password check
69
+     *
70
+     * @return int
71
+     */
72
+    public function getLastCheck(): int;
73
+
74
+    /**
75
+     * Set the timestamp of the last password check
76
+     *
77
+     * @param int $time
78
+     */
79
+    public function setLastCheck(int $time);
80
+
81
+    /**
82
+     * Get the authentication scope for this token
83
+     *
84
+     * @return string
85
+     */
86
+    public function getScope(): string;
87
+
88
+    /**
89
+     * Get the authentication scope for this token
90
+     *
91
+     * @return array
92
+     */
93
+    public function getScopeAsArray(): array;
94
+
95
+    /**
96
+     * Set the authentication scope for this token
97
+     *
98
+     * @param array $scope
99
+     */
100
+    public function setScope($scope);
101
+
102
+    /**
103
+     * Get the name of the token
104
+     * @return string
105
+     */
106
+    public function getName(): string;
107
+
108
+    /**
109
+     * Get the remember state of the token
110
+     *
111
+     * @return int
112
+     */
113
+    public function getRemember(): int;
114
+
115
+    /**
116
+     * Set the token
117
+     *
118
+     * @param string $token
119
+     */
120
+    public function setToken(string $token);
121
+
122
+    /**
123
+     * Set the password
124
+     *
125
+     * @param string $password
126
+     */
127
+    public function setPassword(string $password);
128
+
129
+    /**
130
+     * Set the expiration time of the token
131
+     *
132
+     * @param int|null $expires
133
+     */
134
+    public function setExpires($expires);
135 135
 }
Please login to merge, or discard this patch.
lib/private/DB/AdapterOCI8.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@
 block discarded – undo
26 26
 namespace OC\DB;
27 27
 
28 28
 class AdapterOCI8 extends Adapter {
29
-	public function lastInsertId($table) {
30
-		if (is_null($table)) {
31
-			throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()');
32
-		}
33
-		if ($table !== null) {
34
-			$suffix = '_SEQ';
35
-			$table = '"' . $table . $suffix . '"';
36
-		}
37
-		return $this->conn->realLastInsertId($table);
38
-	}
29
+    public function lastInsertId($table) {
30
+        if (is_null($table)) {
31
+            throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()');
32
+        }
33
+        if ($table !== null) {
34
+            $suffix = '_SEQ';
35
+            $table = '"' . $table . $suffix . '"';
36
+        }
37
+        return $this->conn->realLastInsertId($table);
38
+    }
39 39
 
40
-	public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
40
+    public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
41 41
 
42
-	public function fixupStatement($statement) {
43
-		$statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement);
44
-		$statement = str_replace('`', '"', $statement);
45
-		$statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement);
46
-		$statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
47
-		return $statement;
48
-	}
42
+    public function fixupStatement($statement) {
43
+        $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement);
44
+        $statement = str_replace('`', '"', $statement);
45
+        $statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement);
46
+        $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
47
+        return $statement;
48
+    }
49 49
 }
Please login to merge, or discard this patch.
lib/private/Group/Backend.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -29,107 +29,107 @@
 block discarded – undo
29 29
  * Abstract base class for user management
30 30
  */
31 31
 abstract class Backend implements \OCP\GroupInterface {
32
-	/**
33
-	 * error code for functions not provided by the group backend
34
-	 */
35
-	public const NOT_IMPLEMENTED = -501;
32
+    /**
33
+     * error code for functions not provided by the group backend
34
+     */
35
+    public const NOT_IMPLEMENTED = -501;
36 36
 
37
-	protected $possibleActions = [
38
-		self::CREATE_GROUP => 'createGroup',
39
-		self::DELETE_GROUP => 'deleteGroup',
40
-		self::ADD_TO_GROUP => 'addToGroup',
41
-		self::REMOVE_FROM_GOUP => 'removeFromGroup',
42
-		self::COUNT_USERS => 'countUsersInGroup',
43
-		self::GROUP_DETAILS => 'getGroupDetails',
44
-		self::IS_ADMIN => 'isAdmin',
45
-	];
37
+    protected $possibleActions = [
38
+        self::CREATE_GROUP => 'createGroup',
39
+        self::DELETE_GROUP => 'deleteGroup',
40
+        self::ADD_TO_GROUP => 'addToGroup',
41
+        self::REMOVE_FROM_GOUP => 'removeFromGroup',
42
+        self::COUNT_USERS => 'countUsersInGroup',
43
+        self::GROUP_DETAILS => 'getGroupDetails',
44
+        self::IS_ADMIN => 'isAdmin',
45
+    ];
46 46
 
47
-	/**
48
-	 * Get all supported actions
49
-	 * @return int bitwise-or'ed actions
50
-	 *
51
-	 * Returns the supported actions as int to be
52
-	 * compared with \OC\Group\Backend::CREATE_GROUP etc.
53
-	 */
54
-	public function getSupportedActions() {
55
-		$actions = 0;
56
-		foreach ($this->possibleActions as $action => $methodName) {
57
-			if (method_exists($this, $methodName)) {
58
-				$actions |= $action;
59
-			}
60
-		}
47
+    /**
48
+     * Get all supported actions
49
+     * @return int bitwise-or'ed actions
50
+     *
51
+     * Returns the supported actions as int to be
52
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
53
+     */
54
+    public function getSupportedActions() {
55
+        $actions = 0;
56
+        foreach ($this->possibleActions as $action => $methodName) {
57
+            if (method_exists($this, $methodName)) {
58
+                $actions |= $action;
59
+            }
60
+        }
61 61
 
62
-		return $actions;
63
-	}
62
+        return $actions;
63
+    }
64 64
 
65
-	/**
66
-	 * Check if backend implements actions
67
-	 * @param int $actions bitwise-or'ed actions
68
-	 * @return bool
69
-	 *
70
-	 * Returns the supported actions as int to be
71
-	 * compared with \OC\Group\Backend::CREATE_GROUP etc.
72
-	 */
73
-	public function implementsActions($actions) {
74
-		return (bool)($this->getSupportedActions() & $actions);
75
-	}
65
+    /**
66
+     * Check if backend implements actions
67
+     * @param int $actions bitwise-or'ed actions
68
+     * @return bool
69
+     *
70
+     * Returns the supported actions as int to be
71
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
72
+     */
73
+    public function implementsActions($actions) {
74
+        return (bool)($this->getSupportedActions() & $actions);
75
+    }
76 76
 
77
-	/**
78
-	 * is user in group?
79
-	 * @param string $uid uid of the user
80
-	 * @param string $gid gid of the group
81
-	 * @return bool
82
-	 *
83
-	 * Checks whether the user is member of a group or not.
84
-	 */
85
-	public function inGroup($uid, $gid) {
86
-		return in_array($gid, $this->getUserGroups($uid));
87
-	}
77
+    /**
78
+     * is user in group?
79
+     * @param string $uid uid of the user
80
+     * @param string $gid gid of the group
81
+     * @return bool
82
+     *
83
+     * Checks whether the user is member of a group or not.
84
+     */
85
+    public function inGroup($uid, $gid) {
86
+        return in_array($gid, $this->getUserGroups($uid));
87
+    }
88 88
 
89
-	/**
90
-	 * Get all groups a user belongs to
91
-	 * @param string $uid Name of the user
92
-	 * @return array an array of group names
93
-	 *
94
-	 * This function fetches all groups a user belongs to. It does not check
95
-	 * if the user exists at all.
96
-	 */
97
-	public function getUserGroups($uid) {
98
-		return [];
99
-	}
89
+    /**
90
+     * Get all groups a user belongs to
91
+     * @param string $uid Name of the user
92
+     * @return array an array of group names
93
+     *
94
+     * This function fetches all groups a user belongs to. It does not check
95
+     * if the user exists at all.
96
+     */
97
+    public function getUserGroups($uid) {
98
+        return [];
99
+    }
100 100
 
101
-	/**
102
-	 * get a list of all groups
103
-	 * @param string $search
104
-	 * @param int $limit
105
-	 * @param int $offset
106
-	 * @return array an array of group names
107
-	 *
108
-	 * Returns a list with all groups
109
-	 */
101
+    /**
102
+     * get a list of all groups
103
+     * @param string $search
104
+     * @param int $limit
105
+     * @param int $offset
106
+     * @return array an array of group names
107
+     *
108
+     * Returns a list with all groups
109
+     */
110 110
 
111
-	public function getGroups($search = '', $limit = -1, $offset = 0) {
112
-		return [];
113
-	}
111
+    public function getGroups($search = '', $limit = -1, $offset = 0) {
112
+        return [];
113
+    }
114 114
 
115
-	/**
116
-	 * check if a group exists
117
-	 * @param string $gid
118
-	 * @return bool
119
-	 */
120
-	public function groupExists($gid) {
121
-		return in_array($gid, $this->getGroups($gid, 1));
122
-	}
115
+    /**
116
+     * check if a group exists
117
+     * @param string $gid
118
+     * @return bool
119
+     */
120
+    public function groupExists($gid) {
121
+        return in_array($gid, $this->getGroups($gid, 1));
122
+    }
123 123
 
124
-	/**
125
-	 * get a list of all users in a group
126
-	 * @param string $gid
127
-	 * @param string $search
128
-	 * @param int $limit
129
-	 * @param int $offset
130
-	 * @return array an array of user ids
131
-	 */
132
-	public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
133
-		return [];
134
-	}
124
+    /**
125
+     * get a list of all users in a group
126
+     * @param string $gid
127
+     * @param string $search
128
+     * @param int $limit
129
+     * @param int $offset
130
+     * @return array an array of user ids
131
+     */
132
+    public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
133
+        return [];
134
+    }
135 135
 }
Please login to merge, or discard this patch.
apps/encryption/lib/Session.php 1 patch
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -31,157 +31,157 @@
 block discarded – undo
31 31
 
32 32
 class Session {
33 33
 
34
-	/** @var ISession */
35
-	protected $session;
36
-
37
-	public const NOT_INITIALIZED = '0';
38
-	public const INIT_EXECUTED = '1';
39
-	public const INIT_SUCCESSFUL = '2';
40
-
41
-	/**
42
-	 * @param ISession $session
43
-	 */
44
-	public function __construct(ISession $session) {
45
-		$this->session = $session;
46
-	}
47
-
48
-	/**
49
-	 * Sets status of encryption app
50
-	 *
51
-	 * @param string $status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
52
-	 */
53
-	public function setStatus($status) {
54
-		$this->session->set('encryptionInitialized', $status);
55
-	}
56
-
57
-	/**
58
-	 * Gets status if we already tried to initialize the encryption app
59
-	 *
60
-	 * @return string init status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
61
-	 */
62
-	public function getStatus() {
63
-		$status = $this->session->get('encryptionInitialized');
64
-		if (is_null($status)) {
65
-			$status = self::NOT_INITIALIZED;
66
-		}
67
-
68
-		return $status;
69
-	}
70
-
71
-	/**
72
-	 * check if encryption was initialized successfully
73
-	 *
74
-	 * @return bool
75
-	 */
76
-	public function isReady() {
77
-		$status = $this->getStatus();
78
-		return $status === self::INIT_SUCCESSFUL;
79
-	}
80
-
81
-	/**
82
-	 * Gets user or public share private key from session
83
-	 *
84
-	 * @return string $privateKey The user's plaintext private key
85
-	 * @throws Exceptions\PrivateKeyMissingException
86
-	 */
87
-	public function getPrivateKey() {
88
-		$key = $this->session->get('privateKey');
89
-		if (is_null($key)) {
90
-			throw new Exceptions\PrivateKeyMissingException('please try to log-out and log-in again', 0);
91
-		}
92
-		return $key;
93
-	}
94
-
95
-	/**
96
-	 * check if private key is set
97
-	 *
98
-	 * @return boolean
99
-	 */
100
-	public function isPrivateKeySet() {
101
-		$key = $this->session->get('privateKey');
102
-		if (is_null($key)) {
103
-			return false;
104
-		}
105
-
106
-		return true;
107
-	}
108
-
109
-	/**
110
-	 * Sets user private key to session
111
-	 *
112
-	 * @param string $key users private key
113
-	 *
114
-	 * @note this should only be set on login
115
-	 */
116
-	public function setPrivateKey($key) {
117
-		$this->session->set('privateKey', $key);
118
-	}
119
-
120
-	/**
121
-	 * store data needed for the decrypt all operation in the session
122
-	 *
123
-	 * @param string $user
124
-	 * @param string $key
125
-	 */
126
-	public function prepareDecryptAll($user, $key) {
127
-		$this->session->set('decryptAll', true);
128
-		$this->session->set('decryptAllKey', $key);
129
-		$this->session->set('decryptAllUid', $user);
130
-	}
131
-
132
-	/**
133
-	 * check if we are in decrypt all mode
134
-	 *
135
-	 * @return bool
136
-	 */
137
-	public function decryptAllModeActivated() {
138
-		$decryptAll = $this->session->get('decryptAll');
139
-		return ($decryptAll === true);
140
-	}
141
-
142
-	/**
143
-	 * get uid used for decrypt all operation
144
-	 *
145
-	 * @return string
146
-	 * @throws \Exception
147
-	 */
148
-	public function getDecryptAllUid() {
149
-		$uid = $this->session->get('decryptAllUid');
150
-		if (is_null($uid) && $this->decryptAllModeActivated()) {
151
-			throw new \Exception('No uid found while in decrypt all mode');
152
-		} elseif (is_null($uid)) {
153
-			throw new \Exception('Please activate decrypt all mode first');
154
-		}
155
-
156
-		return $uid;
157
-	}
158
-
159
-	/**
160
-	 * get private key for decrypt all operation
161
-	 *
162
-	 * @return string
163
-	 * @throws PrivateKeyMissingException
164
-	 */
165
-	public function getDecryptAllKey() {
166
-		$privateKey = $this->session->get('decryptAllKey');
167
-		if (is_null($privateKey) && $this->decryptAllModeActivated()) {
168
-			throw new PrivateKeyMissingException('No private key found while in decrypt all mode');
169
-		} elseif (is_null($privateKey)) {
170
-			throw new PrivateKeyMissingException('Please activate decrypt all mode first');
171
-		}
172
-
173
-		return $privateKey;
174
-	}
175
-
176
-	/**
177
-	 * remove keys from session
178
-	 */
179
-	public function clear() {
180
-		$this->session->remove('publicSharePrivateKey');
181
-		$this->session->remove('privateKey');
182
-		$this->session->remove('encryptionInitialized');
183
-		$this->session->remove('decryptAll');
184
-		$this->session->remove('decryptAllKey');
185
-		$this->session->remove('decryptAllUid');
186
-	}
34
+    /** @var ISession */
35
+    protected $session;
36
+
37
+    public const NOT_INITIALIZED = '0';
38
+    public const INIT_EXECUTED = '1';
39
+    public const INIT_SUCCESSFUL = '2';
40
+
41
+    /**
42
+     * @param ISession $session
43
+     */
44
+    public function __construct(ISession $session) {
45
+        $this->session = $session;
46
+    }
47
+
48
+    /**
49
+     * Sets status of encryption app
50
+     *
51
+     * @param string $status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
52
+     */
53
+    public function setStatus($status) {
54
+        $this->session->set('encryptionInitialized', $status);
55
+    }
56
+
57
+    /**
58
+     * Gets status if we already tried to initialize the encryption app
59
+     *
60
+     * @return string init status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
61
+     */
62
+    public function getStatus() {
63
+        $status = $this->session->get('encryptionInitialized');
64
+        if (is_null($status)) {
65
+            $status = self::NOT_INITIALIZED;
66
+        }
67
+
68
+        return $status;
69
+    }
70
+
71
+    /**
72
+     * check if encryption was initialized successfully
73
+     *
74
+     * @return bool
75
+     */
76
+    public function isReady() {
77
+        $status = $this->getStatus();
78
+        return $status === self::INIT_SUCCESSFUL;
79
+    }
80
+
81
+    /**
82
+     * Gets user or public share private key from session
83
+     *
84
+     * @return string $privateKey The user's plaintext private key
85
+     * @throws Exceptions\PrivateKeyMissingException
86
+     */
87
+    public function getPrivateKey() {
88
+        $key = $this->session->get('privateKey');
89
+        if (is_null($key)) {
90
+            throw new Exceptions\PrivateKeyMissingException('please try to log-out and log-in again', 0);
91
+        }
92
+        return $key;
93
+    }
94
+
95
+    /**
96
+     * check if private key is set
97
+     *
98
+     * @return boolean
99
+     */
100
+    public function isPrivateKeySet() {
101
+        $key = $this->session->get('privateKey');
102
+        if (is_null($key)) {
103
+            return false;
104
+        }
105
+
106
+        return true;
107
+    }
108
+
109
+    /**
110
+     * Sets user private key to session
111
+     *
112
+     * @param string $key users private key
113
+     *
114
+     * @note this should only be set on login
115
+     */
116
+    public function setPrivateKey($key) {
117
+        $this->session->set('privateKey', $key);
118
+    }
119
+
120
+    /**
121
+     * store data needed for the decrypt all operation in the session
122
+     *
123
+     * @param string $user
124
+     * @param string $key
125
+     */
126
+    public function prepareDecryptAll($user, $key) {
127
+        $this->session->set('decryptAll', true);
128
+        $this->session->set('decryptAllKey', $key);
129
+        $this->session->set('decryptAllUid', $user);
130
+    }
131
+
132
+    /**
133
+     * check if we are in decrypt all mode
134
+     *
135
+     * @return bool
136
+     */
137
+    public function decryptAllModeActivated() {
138
+        $decryptAll = $this->session->get('decryptAll');
139
+        return ($decryptAll === true);
140
+    }
141
+
142
+    /**
143
+     * get uid used for decrypt all operation
144
+     *
145
+     * @return string
146
+     * @throws \Exception
147
+     */
148
+    public function getDecryptAllUid() {
149
+        $uid = $this->session->get('decryptAllUid');
150
+        if (is_null($uid) && $this->decryptAllModeActivated()) {
151
+            throw new \Exception('No uid found while in decrypt all mode');
152
+        } elseif (is_null($uid)) {
153
+            throw new \Exception('Please activate decrypt all mode first');
154
+        }
155
+
156
+        return $uid;
157
+    }
158
+
159
+    /**
160
+     * get private key for decrypt all operation
161
+     *
162
+     * @return string
163
+     * @throws PrivateKeyMissingException
164
+     */
165
+    public function getDecryptAllKey() {
166
+        $privateKey = $this->session->get('decryptAllKey');
167
+        if (is_null($privateKey) && $this->decryptAllModeActivated()) {
168
+            throw new PrivateKeyMissingException('No private key found while in decrypt all mode');
169
+        } elseif (is_null($privateKey)) {
170
+            throw new PrivateKeyMissingException('Please activate decrypt all mode first');
171
+        }
172
+
173
+        return $privateKey;
174
+    }
175
+
176
+    /**
177
+     * remove keys from session
178
+     */
179
+    public function clear() {
180
+        $this->session->remove('publicSharePrivateKey');
181
+        $this->session->remove('privateKey');
182
+        $this->session->remove('encryptionInitialized');
183
+        $this->session->remove('decryptAll');
184
+        $this->session->remove('decryptAllKey');
185
+        $this->session->remove('decryptAllUid');
186
+    }
187 187
 }
Please login to merge, or discard this patch.
apps/files/lib/Activity/Helper.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -26,60 +26,60 @@
 block discarded – undo
26 26
 use OCP\ITagManager;
27 27
 
28 28
 class Helper {
29
-	/** If a user has a lot of favorites the query might get too slow and long */
30
-	public const FAVORITE_LIMIT = 50;
29
+    /** If a user has a lot of favorites the query might get too slow and long */
30
+    public const FAVORITE_LIMIT = 50;
31 31
 
32
-	/** @var ITagManager */
33
-	protected $tagManager;
32
+    /** @var ITagManager */
33
+    protected $tagManager;
34 34
 
35
-	/**
36
-	 * @param ITagManager $tagManager
37
-	 */
38
-	public function __construct(ITagManager $tagManager) {
39
-		$this->tagManager = $tagManager;
40
-	}
35
+    /**
36
+     * @param ITagManager $tagManager
37
+     */
38
+    public function __construct(ITagManager $tagManager) {
39
+        $this->tagManager = $tagManager;
40
+    }
41 41
 
42
-	/**
43
-	 * Returns an array with the favorites
44
-	 *
45
-	 * @param string $user
46
-	 * @return array
47
-	 * @throws \RuntimeException when too many or no favorites where found
48
-	 */
49
-	public function getFavoriteFilePaths($user) {
50
-		$tags = $this->tagManager->load('files', [], false, $user);
51
-		$favorites = $tags->getFavorites();
42
+    /**
43
+     * Returns an array with the favorites
44
+     *
45
+     * @param string $user
46
+     * @return array
47
+     * @throws \RuntimeException when too many or no favorites where found
48
+     */
49
+    public function getFavoriteFilePaths($user) {
50
+        $tags = $this->tagManager->load('files', [], false, $user);
51
+        $favorites = $tags->getFavorites();
52 52
 
53
-		if (empty($favorites)) {
54
-			throw new \RuntimeException('No favorites', 1);
55
-		} elseif (isset($favorites[self::FAVORITE_LIMIT])) {
56
-			throw new \RuntimeException('Too many favorites', 2);
57
-		}
53
+        if (empty($favorites)) {
54
+            throw new \RuntimeException('No favorites', 1);
55
+        } elseif (isset($favorites[self::FAVORITE_LIMIT])) {
56
+            throw new \RuntimeException('Too many favorites', 2);
57
+        }
58 58
 
59
-		// Can not DI because the user is not known on instantiation
60
-		$rootFolder = \OC::$server->getUserFolder($user);
61
-		$folders = $items = [];
62
-		foreach ($favorites as $favorite) {
63
-			$nodes = $rootFolder->getById($favorite);
64
-			if (!empty($nodes)) {
65
-				/** @var \OCP\Files\Node $node */
66
-				$node = array_shift($nodes);
67
-				$path = substr($node->getPath(), strlen($user . '/files/'));
59
+        // Can not DI because the user is not known on instantiation
60
+        $rootFolder = \OC::$server->getUserFolder($user);
61
+        $folders = $items = [];
62
+        foreach ($favorites as $favorite) {
63
+            $nodes = $rootFolder->getById($favorite);
64
+            if (!empty($nodes)) {
65
+                /** @var \OCP\Files\Node $node */
66
+                $node = array_shift($nodes);
67
+                $path = substr($node->getPath(), strlen($user . '/files/'));
68 68
 
69
-				$items[] = $path;
70
-				if ($node instanceof Folder) {
71
-					$folders[] = $path;
72
-				}
73
-			}
74
-		}
69
+                $items[] = $path;
70
+                if ($node instanceof Folder) {
71
+                    $folders[] = $path;
72
+                }
73
+            }
74
+        }
75 75
 
76
-		if (empty($items)) {
77
-			throw new \RuntimeException('No favorites', 1);
78
-		}
76
+        if (empty($items)) {
77
+            throw new \RuntimeException('No favorites', 1);
78
+        }
79 79
 
80
-		return [
81
-			'items' => $items,
82
-			'folders' => $folders,
83
-		];
84
-	}
80
+        return [
81
+            'items' => $items,
82
+            'folders' => $folders,
83
+        ];
84
+    }
85 85
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -26,51 +26,51 @@
 block discarded – undo
26 26
 use Sabre\DAV\Exception;
27 27
 
28 28
 class InvalidPath extends Exception {
29
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
29
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
30 30
 
31
-	/**
32
-	 * @var bool
33
-	 */
34
-	private $retry;
31
+    /**
32
+     * @var bool
33
+     */
34
+    private $retry;
35 35
 
36
-	/**
37
-	 * @param string $message
38
-	 * @param bool $retry
39
-	 * @param \Exception|null $previous
40
-	 */
41
-	public function __construct($message, $retry = false, \Exception $previous = null) {
42
-		parent::__construct($message, 0, $previous);
43
-		$this->retry = $retry;
44
-	}
36
+    /**
37
+     * @param string $message
38
+     * @param bool $retry
39
+     * @param \Exception|null $previous
40
+     */
41
+    public function __construct($message, $retry = false, \Exception $previous = null) {
42
+        parent::__construct($message, 0, $previous);
43
+        $this->retry = $retry;
44
+    }
45 45
 
46
-	/**
47
-	 * Returns the HTTP status code for this exception
48
-	 *
49
-	 * @return int
50
-	 */
51
-	public function getHTTPCode() {
52
-		return 400;
53
-	}
46
+    /**
47
+     * Returns the HTTP status code for this exception
48
+     *
49
+     * @return int
50
+     */
51
+    public function getHTTPCode() {
52
+        return 400;
53
+    }
54 54
 
55
-	/**
56
-	 * This method allows the exception to include additional information
57
-	 * into the WebDAV error response
58
-	 *
59
-	 * @param \Sabre\DAV\Server $server
60
-	 * @param \DOMElement $errorNode
61
-	 * @return void
62
-	 */
63
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
55
+    /**
56
+     * This method allows the exception to include additional information
57
+     * into the WebDAV error response
58
+     *
59
+     * @param \Sabre\DAV\Server $server
60
+     * @param \DOMElement $errorNode
61
+     * @return void
62
+     */
63
+    public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
64 64
 
65
-		// set ownCloud namespace
66
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
65
+        // set ownCloud namespace
66
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
67 67
 
68
-		// adding the retry node
69
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
70
-		$errorNode->appendChild($error);
68
+        // adding the retry node
69
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
70
+        $errorNode->appendChild($error);
71 71
 
72
-		// adding the message node
73
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
74
-		$errorNode->appendChild($error);
75
-	}
72
+        // adding the message node
73
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
74
+        $errorNode->appendChild($error);
75
+    }
76 76
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,26 +29,26 @@
 block discarded – undo
29 29
 use Sabre\DAV\Server;
30 30
 
31 31
 class PasswordLoginForbidden extends NotAuthenticated {
32
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
32
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
33 33
 
34
-	public function getHTTPCode() {
35
-		return 401;
36
-	}
34
+    public function getHTTPCode() {
35
+        return 401;
36
+    }
37 37
 
38
-	/**
39
-	 * This method allows the exception to include additional information
40
-	 * into the WebDAV error response
41
-	 *
42
-	 * @param Server $server
43
-	 * @param DOMElement $errorNode
44
-	 * @return void
45
-	 */
46
-	public function serialize(Server $server, DOMElement $errorNode) {
38
+    /**
39
+     * This method allows the exception to include additional information
40
+     * into the WebDAV error response
41
+     *
42
+     * @param Server $server
43
+     * @param DOMElement $errorNode
44
+     * @return void
45
+     */
46
+    public function serialize(Server $server, DOMElement $errorNode) {
47 47
 
48
-		// set ownCloud namespace
49
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
48
+        // set ownCloud namespace
49
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
50 50
 
51
-		$error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden');
52
-		$errorNode->appendChild($error);
53
-	}
51
+        $error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden');
52
+        $errorNode->appendChild($error);
53
+    }
54 54
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Exception/Forbidden.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
 namespace OCA\DAV\Connector\Sabre\Exception;
24 24
 
25 25
 class Forbidden extends \Sabre\DAV\Exception\Forbidden {
26
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
26
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
27 27
 
28
-	/**
29
-	 * @var bool
30
-	 */
31
-	private $retry;
28
+    /**
29
+     * @var bool
30
+     */
31
+    private $retry;
32 32
 
33
-	/**
34
-	 * @param string $message
35
-	 * @param bool $retry
36
-	 * @param \Exception $previous
37
-	 */
38
-	public function __construct($message, $retry = false, \Exception $previous = null) {
39
-		parent::__construct($message, 0, $previous);
40
-		$this->retry = $retry;
41
-	}
33
+    /**
34
+     * @param string $message
35
+     * @param bool $retry
36
+     * @param \Exception $previous
37
+     */
38
+    public function __construct($message, $retry = false, \Exception $previous = null) {
39
+        parent::__construct($message, 0, $previous);
40
+        $this->retry = $retry;
41
+    }
42 42
 
43
-	/**
44
-	 * This method allows the exception to include additional information
45
-	 * into the WebDAV error response
46
-	 *
47
-	 * @param \Sabre\DAV\Server $server
48
-	 * @param \DOMElement $errorNode
49
-	 * @return void
50
-	 */
51
-	public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
43
+    /**
44
+     * This method allows the exception to include additional information
45
+     * into the WebDAV error response
46
+     *
47
+     * @param \Sabre\DAV\Server $server
48
+     * @param \DOMElement $errorNode
49
+     * @return void
50
+     */
51
+    public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
52 52
 
53
-		// set ownCloud namespace
54
-		$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
53
+        // set ownCloud namespace
54
+        $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
55 55
 
56
-		// adding the retry node
57
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
58
-		$errorNode->appendChild($error);
56
+        // adding the retry node
57
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
58
+        $errorNode->appendChild($error);
59 59
 
60
-		// adding the message node
61
-		$error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
62
-		$errorNode->appendChild($error);
63
-	}
60
+        // adding the message node
61
+        $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
62
+        $errorNode->appendChild($error);
63
+    }
64 64
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/DavAclPlugin.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -43,59 +43,59 @@
 block discarded – undo
43 43
  * @package OCA\DAV\Connector\Sabre
44 44
  */
45 45
 class DavAclPlugin extends \Sabre\DAVACL\Plugin {
46
-	public function __construct() {
47
-		$this->hideNodesFromListings = true;
48
-		$this->allowUnauthenticatedAccess = false;
49
-	}
46
+    public function __construct() {
47
+        $this->hideNodesFromListings = true;
48
+        $this->allowUnauthenticatedAccess = false;
49
+    }
50 50
 
51
-	public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
52
-		$access = parent::checkPrivileges($uri, $privileges, $recursion, false);
53
-		if ($access === false && $throwExceptions) {
54
-			/** @var INode $node */
55
-			$node = $this->server->tree->getNodeForPath($uri);
51
+    public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
52
+        $access = parent::checkPrivileges($uri, $privileges, $recursion, false);
53
+        if ($access === false && $throwExceptions) {
54
+            /** @var INode $node */
55
+            $node = $this->server->tree->getNodeForPath($uri);
56 56
 
57
-			switch (get_class($node)) {
58
-				case AddressBook::class:
59
-					$type = 'Addressbook';
60
-					break;
61
-				default:
62
-					$type = 'Node';
63
-					break;
64
-			}
65
-			throw new NotFound(
66
-				sprintf(
67
-					"%s with name '%s' could not be found",
68
-					$type,
69
-					$node->getName()
70
-				)
71
-			);
72
-		}
57
+            switch (get_class($node)) {
58
+                case AddressBook::class:
59
+                    $type = 'Addressbook';
60
+                    break;
61
+                default:
62
+                    $type = 'Node';
63
+                    break;
64
+            }
65
+            throw new NotFound(
66
+                sprintf(
67
+                    "%s with name '%s' could not be found",
68
+                    $type,
69
+                    $node->getName()
70
+                )
71
+            );
72
+        }
73 73
 
74
-		return $access;
75
-	}
74
+        return $access;
75
+    }
76 76
 
77
-	public function propFind(PropFind $propFind, INode $node) {
78
-		// If the node is neither readable nor writable then fail unless its of
79
-		// the standard user-principal
80
-		if (!($node instanceof User)) {
81
-			$path = $propFind->getPath();
82
-			$readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false);
83
-			$writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false);
84
-			if ($readPermissions === false && $writePermissions === false) {
85
-				$this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, true);
86
-				$this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, true);
87
-			}
88
-		}
77
+    public function propFind(PropFind $propFind, INode $node) {
78
+        // If the node is neither readable nor writable then fail unless its of
79
+        // the standard user-principal
80
+        if (!($node instanceof User)) {
81
+            $path = $propFind->getPath();
82
+            $readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false);
83
+            $writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false);
84
+            if ($readPermissions === false && $writePermissions === false) {
85
+                $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, true);
86
+                $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, true);
87
+            }
88
+        }
89 89
 
90
-		return parent::propFind($propFind, $node);
91
-	}
90
+        return parent::propFind($propFind, $node);
91
+    }
92 92
 
93
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
94
-		$path = $request->getPath();
93
+    public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
94
+        $path = $request->getPath();
95 95
 
96
-		// prevent the plugin from causing an unneeded overhead for file requests
97
-		if (strpos($path, 'files/') !== 0) {
98
-			parent::beforeMethod($request, $response);
99
-		}
100
-	}
96
+        // prevent the plugin from causing an unneeded overhead for file requests
97
+        if (strpos($path, 'files/') !== 0) {
98
+            parent::beforeMethod($request, $response);
99
+        }
100
+    }
101 101
 }
Please login to merge, or discard this patch.