1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Changed routes scopes naming conventions

This commit is contained in:
eldadfux 2019-06-08 16:13:19 +03:00
parent 52fe025b9f
commit 568f95f7f5
7 changed files with 45 additions and 38 deletions

View file

@ -271,6 +271,8 @@ $utopia->init(function() use ($utopia, $request, $response, $register, &$user, $
->setParam('{url}', $request->getServer('HTTP_HOST', '') . $route->getURL())
;
//TODO make sure we get array here
foreach($request->getParams() as $key => $value) { // Set request params as potential abuse keys
$timeLimit->setParam('{param-' . $key . '}', (is_array($value)) ? json_encode($value) : $value);
}

View file

@ -24,12 +24,12 @@ const ROLE_ALL = '*';
* projects.read
* projects.write
*
* database.read
* database.write
* documents.read
* documents.write
*
* storage.files.read
* storage.files.write
* storage.scan
* files.read
* files.write
* files.scan
*
* billing.currencies.read
* billing.vaults.read
@ -59,10 +59,10 @@ $logged = [
'account',
'teams.read',
'teams.write',
'database.read',
'database.write',
'storage.files.read',
'storage.files.write',
'documents.read',
'documents.write',
'files.read',
'files.write',
'billing.currencies.read',
'billing.vaults.read',
'billing.vaults.write',
@ -80,8 +80,8 @@ $logged = [
$admins = [
'users.read',
'users.write',
'database.collections.read',
'database.collections.write',
'collections.read',
'collections.write',
'billing.plans.write',
];
@ -93,7 +93,7 @@ return [
'home',
'console',
'auth',
'storage.files.read',
'files.read',
'locale.read',
'avatars.read',
'health.read',

View file

@ -56,7 +56,7 @@ $utopia
$utopia->get('/v1/database')
->desc('List Collections')
->label('scope', 'database.collections.read')
->label('scope', 'collections.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'listCollections')
->label('sdk.description', 'Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project collections. [Learn more about different API modes](/docs/modes).')
@ -67,7 +67,7 @@ $utopia->get('/v1/database')
->action(
function($search, $limit, $offset, $orderType) use ($response, $projectDB)
{
$vl = new Structure($projectDB);
/*$vl = new Structure($projectDB);
var_dump($vl->isValid(new Document([
'$collection' => Database::SYSTEM_COLLECTION_RULES,
@ -84,7 +84,7 @@ $utopia->get('/v1/database')
'options' => [Database::SYSTEM_COLLECTION_PLATFORMS],
])));
var_dump($vl->getDescription());
var_dump($vl->getDescription());*/
$results = $projectDB->getCollection([
'limit' => $limit,
@ -104,7 +104,7 @@ $utopia->get('/v1/database')
$utopia->get('/v1/database/:collectionId')
->desc('Get Collection')
->label('scope', 'database.collections.read')
->label('scope', 'collections.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'getCollection')
->label('sdk.description', 'Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.')
@ -124,7 +124,7 @@ $utopia->get('/v1/database/:collectionId')
$utopia->post('/v1/database')
->desc('Create Collection')
->label('webhook', 'database.collections.create')
->label('scope', 'database.collections.write')
->label('scope', 'collections.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'createCollection')
->label('sdk.description', 'Create a new Collection.')
@ -179,7 +179,7 @@ $utopia->post('/v1/database')
$utopia->put('/v1/database/:collectionId')
->desc('Update Team')
->label('scope', 'teams.write')
->label('scope', 'collections.write')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateTeam')
->label('sdk.description', 'Update team by its unique ID. Only team owners have write access for this resource.')
@ -217,7 +217,7 @@ $utopia->put('/v1/database/:collectionId')
$utopia->delete('/v1/database/:collectionId')
->desc('Delete Collection')
->label('scope', 'database.collections.write')
->label('scope', 'collections.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'deleteCollection')
->label('sdk.description', 'Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.')
@ -246,7 +246,7 @@ $utopia->delete('/v1/database/:collectionId')
$utopia->get('/v1/database/:collectionId')
->desc('List Documents')
->label('scope', 'database.read')
->label('scope', 'documents.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'listDocuments')
->label('sdk.description', 'Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. [Learn more about different API modes](/docs/modes).')
@ -315,7 +315,7 @@ $utopia->get('/v1/database/:collectionId')
$utopia->get('/v1/database/:collectionId/:documentId')
->desc('Get Document')
->label('scope', 'database.read')
->label('scope', 'documents.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'getDocument')
->label('sdk.description', 'Get document by its unique ID. This endpoint response returns a JSON object with the document data.')
@ -363,7 +363,7 @@ $utopia->get('/v1/database/:collectionId/:documentId')
$utopia->post('/v1/database/:collectionId')
->desc('Create Document')
->label('webhook', 'database.documents.create')
->label('scope', 'database.write')
->label('scope', 'documents.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'createDocument')
->label('sdk.description', 'Create a new Document.')
@ -468,7 +468,7 @@ $utopia->post('/v1/database/:collectionId')
$utopia->patch('/v1/database/:collectionId/:documentId')
->desc('Update Document')
->label('webhook', 'database.documents.patch')
->label('scope', 'database.write')
->label('scope', 'documents.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'updateDocument')
->label('abuse-limit', 200)
@ -543,7 +543,7 @@ $utopia->patch('/v1/database/:collectionId/:documentId')
$utopia->delete('/v1/database/:collectionId/:documentId')
->desc('Delete Document')
->label('scope', 'database.write')
->label('scope', 'documents.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'deleteDocument')
->label('sdk.description', 'Delete document by its unique ID. This endpoint deletes only the parent documents, his attributes and relations to other documents. Child documents **will not** be deleted.')

View file

@ -21,10 +21,13 @@ $scopes = [ // TODO sync with console UI list
'users.write',
'teams.read',
'teams.write',
'database.read',
'database.write',
'storage.files.read',
'storage.files.write',
'collections.read',
'collections.write',
'documents.read',
'documents.write',
'files.read',
'files.write',
//'billing.vaults.read',
//'billing.vaults.write',
//'billing.plans.read',

View file

@ -114,7 +114,7 @@ $mimes = [
$utopia->get('/v1/storage/files')
->desc('List Files')
->label('scope', 'storage.files.read')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'listFiles')
->label('sdk.description', 'Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project files. [Learn more about different API modes](/docs/modes).')
@ -147,7 +147,7 @@ $utopia->get('/v1/storage/files')
$utopia->get('/v1/storage/files/:fileId')
->desc('Get File')
->label('scope', 'storage.files.read')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFile')
->label('sdk.description', 'Get file by its unique ID. This endpoint response returns a JSON object with the file metadata.')
@ -166,7 +166,7 @@ $utopia->get('/v1/storage/files/:fileId')
$utopia->get('/v1/storage/files/:fileId/preview')
->desc('Preview File')
->label('scope', 'storage.files.read')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFilePreview')
->label('sdk.description', 'Get file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets will return file icon image. You can also pass query string arguments for cutting and resizing your preview image.')
@ -293,7 +293,7 @@ $utopia->get('/v1/storage/files/:fileId/preview')
$utopia->get('/v1/storage/files/:fileId/download')
->desc('Download File')
->label('scope', 'storage.files.read')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFileDownload')
->label('sdk.description', 'Get file content by its unique ID. The endpoint response return with a \'Content-Disposition: attachment\' header that tells the browser to start downloading the file to user downloads directory.')
@ -344,7 +344,7 @@ $utopia->get('/v1/storage/files/:fileId/download')
$utopia->get('/v1/storage/files/:fileId/view')
->desc('View File')
->label('scope', 'storage.files.read')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFileView')
->label('sdk.description', 'Get file content by its unique ID. This endpoint is similar to the download method but returns with no \'Content-Disposition: attachment\' header.')

View file

@ -4,7 +4,7 @@
<h1 class="margin-bottom">Welcome to Appwrite Console</h1>
<p class="margin-bottom">Start creating projects and take advantage of Appwrite development tools</p>
<p class="margin-bottom">Start creating projects and take advantage of Appwrite development tools and APIs.</p>
<ul class="margin-bottom-xl clear">
<li class="pull-start margin-end"><a href="/features"><i class="icon-lamp"></i> &nbsp;Learn More</a></li>

View file

@ -19,10 +19,12 @@ $scopes = [ // TODO sync with project list
'users.write',
'teams.read',
'teams.write',
'database.read',
'database.write',
'storage.files.read',
'storage.files.write',
'collections.read',
'collections.write',
'documents.read',
'documents.write',
'files.read',
'files.write',
//'billing.vaults.read',
//'billing.vaults.write',
//'billing.plans.read',