aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLuc Donnet2017-09-19 12:15:50 +0200
committerGitHub2017-09-19 12:15:50 +0200
commit8baf33bc7e46d57dbfbe7eab9848ef0adb38465c (patch)
tree4b10d4a3151f5b74c1d63776366019a311e801f7 /app
parent8673b6d0c0f947209053f66ebb3a77669517566c (diff)
parentafc4f74ebf932328c374491d22b62ffb437aea60 (diff)
downloadchouette-core-8baf33bc7e46d57dbfbe7eab9848ef0adb38465c.tar.bz2
Merge pull request #71 from af83/4446-spec-features-api-keys
4446 spec features api keys
Diffstat (limited to 'app')
-rw-r--r--app/policies/api_key_policy.rb3
-rw-r--r--app/views/api_keys/edit.html.slim2
2 files changed, 3 insertions, 2 deletions
diff --git a/app/policies/api_key_policy.rb b/app/policies/api_key_policy.rb
index bc5c9e433..eb7b84457 100644
--- a/app/policies/api_key_policy.rb
+++ b/app/policies/api_key_policy.rb
@@ -14,6 +14,7 @@ class ApiKeyPolicy < ApplicationPolicy
end
def update?
- organisation_match? && user.has_permission?('api_keys.update')
+ record.try(:organisation_id) == user.organisation_id &&
+ user.has_permission?('api_keys.update')
end
end
diff --git a/app/views/api_keys/edit.html.slim b/app/views/api_keys/edit.html.slim
index b1bd1858d..9d7d1fdb7 100644
--- a/app/views/api_keys/edit.html.slim
+++ b/app/views/api_keys/edit.html.slim
@@ -5,7 +5,7 @@
t('last_update', time: l(@api_key.updated_at, format: :short)),
''
- / Below is secundary actions & optional contents (filters, ...)
+ / Below are secondary actions & optional content (filters, ...)
.row.mb-sm
.col-lg-12.text-right
= ( policy(@api_key).destroy? ? link_to(t('actions.destroy'), api_key_path(@api_key), :method => :delete, class: 'btn btn-default') : '' )