[ARVADOS] updated: 1.3.0-3127-ga13547aec
Git user
git at public.arvados.org
Fri Sep 18 23:22:03 UTC 2020
Summary of changes:
.../20200914203202_public_favorites_project.rb | 5 ++++-
services/api/test/fixtures/groups.yml | 7 +++++++
services/api/test/unit/permission_test.rb | 20 ++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
via a13547aec78a75da2174e083f6015280787cd597 (commit)
from 7e358c01226d55a44ca7b6224f9c33c38510572b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a13547aec78a75da2174e083f6015280787cd597
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri Sep 18 19:21:09 2020 -0400
16811: Add a test that system users/groups can't be deleted.
Also tweak PublicFavoritesProject migration to use up/down instead of
change.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/services/api/db/migrate/20200914203202_public_favorites_project.rb b/services/api/db/migrate/20200914203202_public_favorites_project.rb
index 0718778dd..ef139aa70 100644
--- a/services/api/db/migrate/20200914203202_public_favorites_project.rb
+++ b/services/api/db/migrate/20200914203202_public_favorites_project.rb
@@ -4,7 +4,7 @@
class PublicFavoritesProject < ActiveRecord::Migration[5.2]
include CurrentApiClient
- def change
+ def up
act_as_system_user do
public_project_group
public_project_read_permission
@@ -17,4 +17,7 @@ class PublicFavoritesProject < ActiveRecord::Migration[5.2]
end
end
end
+
+ def down
+ end
end
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index ee0d786bb..31a72f172 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -56,6 +56,13 @@ system_group:
description: System-owned Group
group_class: role
+public_favorites_project:
+ uuid: zzzzz-j7d0g-publicfavorites
+ owner_uuid: zzzzz-tpzed-000000000000000
+ name: Public favorites
+ description: Public favorites
+ group_class: project
+
empty_lonely_group:
uuid: zzzzz-j7d0g-jtp06ulmvsezgyu
owner_uuid: zzzzz-tpzed-000000000000000
diff --git a/services/api/test/unit/permission_test.rb b/services/api/test/unit/permission_test.rb
index 10664474c..123031b35 100644
--- a/services/api/test/unit/permission_test.rb
+++ b/services/api/test/unit/permission_test.rb
@@ -579,4 +579,24 @@ class PermissionTest < ActiveSupport::TestCase
assert users(:active).can?(write: prj.uuid)
assert users(:active).can?(manage: prj.uuid)
end
+
+ [system_user_uuid, anonymous_user_uuid].each do |u|
+ test "cannot delete system user #{u}" do
+ act_as_system_user do
+ assert_raises ArvadosModel::PermissionDeniedError do
+ User.find_by_uuid(u).destroy
+ end
+ end
+ end
+ end
+
+ [system_group_uuid, anonymous_group_uuid, public_project_uuid].each do |g|
+ test "cannot delete system group #{g}" do
+ act_as_system_user do
+ assert_raises ArvadosModel::PermissionDeniedError do
+ Group.find_by_uuid(g).destroy
+ end
+ end
+ end
+ end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list