From 86bc775791d7eef9d7ca92db0f83ca0492ce1f3a Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Fri, 29 Nov 2024 18:57:10 +0530 Subject: [PATCH] Add sites resource type and logs scope --- app/config/roles.php | 2 ++ app/init.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Logs/DeleteLog.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Logs/ListLogs.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Sites/GetSite.php | 1 + 5 files changed, 6 insertions(+) diff --git a/app/config/roles.php b/app/config/roles.php index e18d1c994a..8bc25cfba2 100644 --- a/app/config/roles.php +++ b/app/config/roles.php @@ -60,6 +60,8 @@ $admins = [ 'functions.write', 'sites.read', 'sites.write', + 'log.read', + 'log.write', 'execution.read', 'execution.write', 'rules.read', diff --git a/app/init.php b/app/init.php index 42554a4e87..dfa849c002 100644 --- a/app/init.php +++ b/app/init.php @@ -309,6 +309,7 @@ const METRIC_NETWORK_OUTBOUND = 'network.outbound'; const RESOURCE_TYPE_PROJECTS = 'projects'; const RESOURCE_TYPE_FUNCTIONS = 'functions'; +const RESOURCE_TYPE_SITES = 'sites'; const RESOURCE_TYPE_DATABASES = 'databases'; const RESOURCE_TYPE_BUCKETS = 'buckets'; const RESOURCE_TYPE_PROVIDERS = 'providers'; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/DeleteLog.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/DeleteLog.php index b71e8eb216..c8159ccba0 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/DeleteLog.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/DeleteLog.php @@ -28,6 +28,7 @@ class DeleteLog extends Base ->desc('Delete log') ->groups(['api', 'sites']) ->label('scope', 'log.write') + ->label('resourceType', RESOURCE_TYPE_SITES) ->label('event', 'sites.[siteId].logs.[logId].delete') ->label('audits.event', 'logs.delete') ->label('audits.resource', 'site/{request.siteId}') diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/ListLogs.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/ListLogs.php index 0694d7718e..dd35b1cc64 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/ListLogs.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/ListLogs.php @@ -34,6 +34,7 @@ class ListLogs extends Base ->desc('List logs') ->groups(['api', 'sites']) ->label('scope', 'log.read') + ->label('resourceType', RESOURCE_TYPE_SITES) ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'sites') ->label('sdk.method', 'listLogs') diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/GetSite.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/GetSite.php index abab8d86a4..ffadf0b292 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/GetSite.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/GetSite.php @@ -27,6 +27,7 @@ class GetSite extends Base ->desc('Get site') ->groups(['api', 'sites']) ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'sites') ->label('sdk.method', 'get')