From a3b6d5aa368931b34d684c44e43cc61143e91252 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 2 Aug 2019 09:39:17 +0800 Subject: [PATCH] modify user project package apig --- app/views/users/project_packages/index.json.jbuilder | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/views/users/project_packages/index.json.jbuilder b/app/views/users/project_packages/index.json.jbuilder index a2574d558..ad56be7d2 100644 --- a/app/views/users/project_packages/index.json.jbuilder +++ b/app/views/users/project_packages/index.json.jbuilder @@ -16,5 +16,11 @@ json.project_packages do json.deadline_at package.display_deadline_at json.published_at package.display_published_at + + json.operation do + can_manage = current_user&.id == observed_user.id || current_user&.admin_or_business? + json.can_edit can_manage && package.editable? + json.can_delete can_manage && package.deletable? + end end end \ No newline at end of file