Skip to content

Commit 0881dc7

Browse files
committed
add user storage
1 parent fde560e commit 0881dc7

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

TODO

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
- [v] idp-api
3434
- [v] sharing
3535

36-
- [ ] User profile
36+
- [v] User profile
3737
- [v] Mail handler for templates
3838
- [v] CORS for all
3939
- [v] base64 url decode/encode (include/base64_url_encode.php)
4040
- [ ] Auto-create-storage
4141

4242
- [ ] Cleanup for expired verify tokens, password, deletion
43+
4344
----------------------
4445

4546
------- Storage ------

init.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function initDatabase() {
2222
userId VARCHAR(255) NOT NULL PRIMARY KEY,
2323
clientId VARCHAR(255) NOT NULL
2424
)',
25+
'CREATE TABLE IF NOT EXISTS userStorage (
26+
userId VARCHAR(255) NOT NULL PRIMARY KEY,
27+
storageUrl VARCHAR(255) NOT NULL
28+
)',
2529
'CREATE TABLE IF NOT EXISTS verify (
2630
code VARCHAR(255) NOT NULL PRIMARY KEY,
2731
data TEXT NOT NULL

lib/User.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ public static function getAllowedClients($userId) {
104104
public static function getStorage($userId) {
105105
self::connect();
106106
$query = self::$pdo->prepare(
107-
'SELECT storage FROM userStorage WHERE userId=:userId'
107+
'SELECT storageUrl FROM userStorage WHERE userId=:userId'
108108
);
109109
$query->execute([
110110
':userId' => $userId
111111
]);
112112
$result = [];
113113
while($row = $query->fetch()) {
114-
$result[] = $row['storage'];
114+
$result[] = $row['storageUrl'];
115115
}
116116
return $result;
117117
}
@@ -167,6 +167,11 @@ public static function getUserById($userId) {
167167

168168
$allowedClients = self::getAllowedClients($userData['userId']);
169169
$userData['allowedClients'] = $allowedClients;
170+
$userData['issuer'] = BASEURL;
171+
$storage = self::getStorage($userData['userId']);
172+
if ($storage) {
173+
$userData['storage'] = $storage;
174+
}
170175
return $userData;
171176
}
172177
return false;

0 commit comments

Comments
 (0)