mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Merge pull request #9841 from ArnabChatterjee20k/dat-532
added checking for encrypt and plan allowing encryption of string att…
This commit is contained in:
commit
eab446a828
2 changed files with 6 additions and 2 deletions
|
|
@ -1347,7 +1347,11 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string
|
|||
->inject('dbForProject')
|
||||
->inject('queueForDatabase')
|
||||
->inject('queueForEvents')
|
||||
->action(function (string $databaseId, string $collectionId, string $key, ?int $size, ?bool $required, ?string $default, bool $array, bool $encrypt, Response $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents) {
|
||||
->inject('plan')
|
||||
->action(function (string $databaseId, string $collectionId, string $key, ?int $size, ?bool $required, ?string $default, bool $array, bool $encrypt, Response $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents, array $plan) {
|
||||
if ($encrypt && !empty($plan) && !($plan['databasesAllowEncrypt'] ?? false)) {
|
||||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Encrypted string attributes are not available on your plan. Please upgrade to create encrypted string attributes.');
|
||||
}
|
||||
// Ensure attribute default is within required size
|
||||
$validator = new Text($size, 0);
|
||||
if (!is_null($default) && !$validator->isValid($default)) {
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ class DatabasesCustomServerTest extends Scope
|
|||
'key' => 'lastName',
|
||||
'size' => 256,
|
||||
'required' => true,
|
||||
'encrypt' => true,
|
||||
'encrypt' => true
|
||||
]);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue