8000 added checking for encrypt and plan allowing encryption of string att… by ArnabChatterjee20k · Pull Request #9841 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

added checking for encrypt and plan allowing encryption of string att… #9841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

< 8000 summary data-ga-click="Pull Requests, open view comments menu, type:semantic" data-view-component="true" class="Link--muted select-menu-button btn-link"> Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/controllers/api/databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,11 @@ function updateAttribute(
->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)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/Services/Databases/DatabasesCustomServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public function testCreateEncryptedAttribute(array $data): void
'key' => 'lastName',
'size' => 256,
'required' => true,
'encrypt' => true,
'encrypt' => true
]);


Expand Down
0