add some fixes

This commit is contained in:
Torsten Dittmann
2022-09-09 11:38:54 +02:00
parent b19b9d450f
commit a059ec11e7
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) {
}
}
if ($dbForConsole->getDocument('buckets', 'default')->isEmpty()) {
if ($dbForConsole->getDocument('buckets', 'default')->isEmpty() && !$dbForConsole->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), 'bucket_1')) {
Console::success('[Setup] - Creating default bucket...');
$dbForConsole->createDocument('buckets', new Document([
'$id' => ID::custom('default'),
+1 -1
View File
@@ -434,7 +434,7 @@ Database::addFilter(
}
$value = json_decode($value, true);
$key = App::getEnv('_APP_OPENSSL_KEY_V' . $value['version']);
var_dump(OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag'])));
return OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag']));
}
);
+10 -1
View File
@@ -965,7 +965,7 @@ class V15 extends Migration
break;
default:
continue;
break;
}
usleep(50000);
@@ -1000,6 +1000,15 @@ class V15 extends Migration
* Populate permissions attribute.
*/
$this->populatePermissionsAttribute($document, addCreatePermission: false);
$document->setAttribute('$permissions', Permission::read(Role::any()), Document::SET_TYPE_APPEND);
break;
case 'sessions':
$userId = $document->getAttribute('userId');
$document
->setAttribute('$permissions', Permission::read(Role::user($userId)), Document::SET_TYPE_APPEND)
->setAttribute('$permissions', Permission::update(Role::user($userId)), Document::SET_TYPE_APPEND)
->setAttribute('$permissions', Permission::delete(Role::user($userId)), Document::SET_TYPE_APPEND);
break;
}