diff --git a/app/config/roles.php b/app/config/roles.php index 68f9160b62..fe952b59bd 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -67,12 +67,16 @@ $admins = [ 'documentsdb.collections.write', 'documentsdb.documents.read', 'documentsdb.documents.write', + 'documentsdb.indexes.read', + 'documentsdb.indexes.write', 'vectorsdb.read', 'vectorsdb.write', 'vectorsdb.collections.read', 'vectorsdb.collections.write', 'vectorsdb.documents.read', 'vectorsdb.documents.write', + 'vectorsdb.indexes.read', + 'vectorsdb.indexes.write', 'tables.read', 'tables.write', 'platforms.read', diff --git a/app/config/scopes/project.php b/app/config/scopes/project.php index b704d87fb1..941e236660 100644 --- a/app/config/scopes/project.php +++ b/app/config/scopes/project.php @@ -227,6 +227,14 @@ return [ 'description' => 'Access to create, update, and delete document database documents', 'category' => 'Databases', ], + 'documentsdb.indexes.read' => [ + 'description' => 'Access to read document database collection indexes', + 'category' => 'Databases', + ], + 'documentsdb.indexes.write' => [ + 'description' => 'Access to create, update, and delete document database collection indexes', + 'category' => 'Databases', + ], // VectorsDB 'vectorsdb.read' => [ @@ -253,6 +261,14 @@ return [ 'description' => 'Access to create, update, and delete vector database documents', 'category' => 'Databases', ], + 'vectorsdb.indexes.read' => [ + 'description' => 'Access to read vector database collection indexes', + 'category' => 'Databases', + ], + 'vectorsdb.indexes.write' => [ + 'description' => 'Access to create, update, and delete vector database collection indexes', + 'category' => 'Databases', + ], // Storage 'buckets.read' => [ diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php index 581bcef26b..45cc3b565a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php @@ -38,7 +38,7 @@ class Create extends IndexCreate ->desc('Create index') ->groups(['api', 'database']) ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].create') - ->label('scope', 'documentsdb.collections.write') + ->label('scope', 'documentsdb.indexes.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php index c189434a00..940cc55db1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php @@ -35,7 +35,7 @@ class Delete extends IndexDelete ->setHttpPath('/v1/documentsdb/:databaseId/collections/:collectionId/indexes/:key') ->desc('Delete index') ->groups(['api', 'database']) - ->label('scope', 'documentsdb.collections.write') + ->label('scope', 'documentsdb.indexes.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].update') ->label('audits.event', 'index.delete') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Get.php index f490e0d68b..3e9402545d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Get.php @@ -31,7 +31,7 @@ class Get extends IndexGet ->setHttpPath('/v1/documentsdb/:databaseId/collections/:collectionId/indexes/:key') ->desc('Get index') ->groups(['api', 'database']) - ->label('scope', 'documentsdb.collections.read') + ->label('scope', 'documentsdb.indexes.read') ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/XList.php index 00acfadc99..d0c13800e9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/XList.php @@ -32,7 +32,7 @@ class XList extends IndexXList ->setHttpPath('/v1/documentsdb/:databaseId/collections/:collectionId/indexes') ->desc('List indexes') ->groups(['api', 'database']) - ->label('scope', 'documentsdb.collections.read') + ->label('scope', 'documentsdb.indexes.read') ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php index 64661f0e48..d70d498c7a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php @@ -38,7 +38,7 @@ class Create extends IndexCreate ->desc('Create index') ->groups(['api', 'database']) ->label('event', 'databases.[databaseId].tables.[tableId].indexes.[indexId].create') - ->label('scope', 'vectorsdb.collections.write') + ->label('scope', 'vectorsdb.indexes.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php index 11d52df6d2..d79e193d43 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php @@ -35,7 +35,7 @@ class Delete extends IndexDelete ->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes/:key') ->desc('Delete index') ->groups(['api', 'database']) - ->label('scope', 'vectorsdb.collections.write') + ->label('scope', 'vectorsdb.indexes.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].update') ->label('audits.event', 'index.delete') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Get.php index bfcba444cf..9d38d6810b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Get.php @@ -31,7 +31,7 @@ class Get extends IndexGet ->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes/:key') ->desc('Get index') ->groups(['api', 'database']) - ->label('scope', 'vectorsdb.collections.read') + ->label('scope', 'vectorsdb.indexes.read') ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/XList.php index 8e42524127..024d212ace 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/XList.php @@ -32,7 +32,7 @@ class XList extends IndexXList ->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes') ->desc('List indexes') ->groups(['api', 'database']) - ->label('scope', 'vectorsdb.collections.read') + ->label('scope', 'vectorsdb.indexes.read') ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index fe9c61980c..951ad4b78b 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -126,12 +126,16 @@ trait ProjectCustom 'documentsdb.collections.write', 'documentsdb.documents.read', 'documentsdb.documents.write', + 'documentsdb.indexes.read', + 'documentsdb.indexes.write', 'vectorsdb.read', 'vectorsdb.write', 'vectorsdb.collections.read', 'vectorsdb.collections.write', 'vectorsdb.documents.read', 'vectorsdb.documents.write', + 'vectorsdb.indexes.read', + 'vectorsdb.indexes.write', 'tables.read', 'tables.write', 'documents.read',