Merge branch '19146-can-write-manage'
[arvados.git] / services / api / app / models / user.rb
index 141bccef21d63d94b1644b2c99f7f8ffd8a752d4..52d36ac57735f0c16d4b0ed6271a50681e08e05b 100644 (file)
@@ -112,7 +112,6 @@ class User < ArvadosModel
   end
 
   def can?(actions)
-    return true if is_admin
     actions.each do |action, target|
       unless target.nil?
         if target.respond_to? :uuid
@@ -136,7 +135,7 @@ class User < ArvadosModel
 
       user_uuids_subquery = USER_UUIDS_SUBQUERY_TEMPLATE % {user: "$1", perm_level: "$3"}
 
-      unless ActiveRecord::Base.connection.
+      if !is_admin && !ActiveRecord::Base.connection.
         exec_query(%{
 SELECT 1 FROM #{PERMISSION_VIEW}
   WHERE user_uuid in (#{user_uuids_subquery}) and