mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: add stricter checks according to review
This commit is contained in:
@@ -82,12 +82,13 @@ class Create extends Action
|
||||
$fileSecurity = $bucket->getAttribute('fileSecurity', false);
|
||||
$validator = new Authorization(Database::PERMISSION_UPDATE);
|
||||
$bucketPermission = $validator->isValid($bucket->getUpdate());
|
||||
if (!$fileSecurity && !$bucketPermission) {
|
||||
throw new Exception(Exception::USER_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
$filePermission = $validator->isValid($file->getUpdate());
|
||||
if ($fileSecurity && !$bucketPermission && !$filePermission) {
|
||||
if ($fileSecurity) {
|
||||
$filePermission = $validator->isValid($file->getUpdate());
|
||||
if (!$bucketPermission && !$filePermission) {
|
||||
throw new Exception(Exception::USER_UNAUTHORIZED);
|
||||
}
|
||||
} elseif (!$bucketPermission) {
|
||||
throw new Exception(Exception::USER_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class Get extends Action
|
||||
// calculate maxAge based on expiry date
|
||||
$maxAge = PHP_INT_MAX;
|
||||
$expire = $token->getAttribute('expire');
|
||||
if ($expire != null) {
|
||||
if ($expire !== null) {
|
||||
$now = new \DateTime();
|
||||
$expiryDate = new \DateTime($expire);
|
||||
if ($expiryDate < $now) {
|
||||
|
||||
@@ -177,7 +177,7 @@ class OpenAPI3 extends Format
|
||||
|
||||
$namespace = $sdk->getNamespace() ?? 'default';
|
||||
|
||||
$desc = $desc ?? '';
|
||||
$desc ??= '';
|
||||
$descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc;
|
||||
|
||||
$temp = [
|
||||
|
||||
@@ -173,7 +173,7 @@ class Swagger2 extends Format
|
||||
|
||||
$namespace = $sdk->getNamespace() ?? 'default';
|
||||
|
||||
$desc = $desc ?? '';
|
||||
$desc ??= '';
|
||||
$descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc;
|
||||
|
||||
$temp = [
|
||||
|
||||
Reference in New Issue
Block a user