diff --git a/app/config/roles.php b/app/config/roles.php index 8548dcc2f1..92ce422997 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -32,10 +32,6 @@ $admins = [ 'users.write', 'collections.read', 'collections.write', - 'attributes.read', - 'attributes.write', - 'indexes.read', - 'indexes.write', 'platforms.read', 'platforms.write', 'keys.read', diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index d7066df6fa..592a1ebe2f 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -425,7 +425,7 @@ App::post('/v1/database/collections/:collectionId/attributes/string') ->desc('Create String Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') ->label('sdk.method', 'createStringAttribute') @@ -464,7 +464,7 @@ App::post('/v1/database/collections/:collectionId/attributes/email') ->desc('Create Email Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createEmailAttribute') @@ -503,7 +503,7 @@ App::post('/v1/database/collections/:collectionId/attributes/ip') ->desc('Create IP Address Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createIpAttribute') @@ -542,7 +542,7 @@ App::post('/v1/database/collections/:collectionId/attributes/url') ->desc('Create IP Address Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createUrlAttribute') @@ -582,7 +582,7 @@ App::post('/v1/database/collections/:collectionId/attributes/integer') ->desc('Create Integer Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createIntegerAttribute') @@ -627,7 +627,7 @@ App::post('/v1/database/collections/:collectionId/attributes/float') ->desc('Create Float Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createFloatAttribute') @@ -672,7 +672,7 @@ App::post('/v1/database/collections/:collectionId/attributes/boolean') ->desc('Create Boolean Attribute') ->groups(['api', 'database']) ->label('event', 'database.attributes.create') - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('sdk.namespace', 'database') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createBooleanAttribute') @@ -709,7 +709,7 @@ App::post('/v1/database/collections/:collectionId/attributes/boolean') App::get('/v1/database/collections/:collectionId/attributes') ->desc('List Attributes') ->groups(['api', 'database']) - ->label('scope', 'attributes.read') + ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') ->label('sdk.method', 'listAttributes') @@ -747,7 +747,7 @@ App::get('/v1/database/collections/:collectionId/attributes') App::get('/v1/database/collections/:collectionId/attributes/:attributeId') ->desc('Get Attribute') ->groups(['api', 'database']) - ->label('scope', 'attributes.read') + ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') ->label('sdk.method', 'getAttribute') @@ -788,7 +788,7 @@ App::get('/v1/database/collections/:collectionId/attributes/:attributeId') App::delete('/v1/database/collections/:collectionId/attributes/:attributeId') ->desc('Delete Attribute') ->groups(['api', 'database']) - ->label('scope', 'attributes.write') + ->label('scope', 'collections.write') ->label('event', 'database.attributes.delete') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') @@ -854,7 +854,7 @@ App::post('/v1/database/collections/:collectionId/indexes') ->desc('Create Index') ->groups(['api', 'database']) ->label('event', 'database.indexes.create') - ->label('scope', 'indexes.write') + ->label('scope', 'collections.write') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') ->label('sdk.method', 'createIndex') @@ -941,7 +941,7 @@ App::post('/v1/database/collections/:collectionId/indexes') App::get('/v1/database/collections/:collectionId/indexes') ->desc('List Indexes') ->groups(['api', 'database']) - ->label('scope', 'indexes.read') + ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') ->label('sdk.method', 'listIndexes') @@ -979,7 +979,7 @@ App::get('/v1/database/collections/:collectionId/indexes') App::get('/v1/database/collections/:collectionId/indexes/:indexId') ->desc('Get Index') ->groups(['api', 'database']) - ->label('scope', 'indexes.read') + ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') ->label('sdk.method', 'getIndex') @@ -1020,7 +1020,7 @@ App::get('/v1/database/collections/:collectionId/indexes/:indexId') App::delete('/v1/database/collections/:collectionId/indexes/:indexId') ->desc('Delete Index') ->groups(['api', 'database']) - ->label('scope', 'indexes.write') + ->label('scope', 'collections.write') ->label('event', 'database.indexes.delete') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'database') diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index fcbbf41a65..6cfcaef625 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -70,10 +70,6 @@ trait ProjectCustom 'teams.write', 'collections.read', 'collections.write', - 'attributes.read', - 'attributes.write', - 'indexes.read', - 'indexes.write', 'documents.read', 'documents.write', 'files.read',