Rethink permissions in CodeOcean for usage in schools and adopt views
This commit is contained in:
@ -1,14 +1,9 @@
|
||||
class ExecutionEnvironmentPolicy < AdminOnlyPolicy
|
||||
def author?
|
||||
@user == @record.author
|
||||
end
|
||||
private :author?
|
||||
|
||||
[:execute_command?, :shell?, :statistics?].each do |action|
|
||||
define_method(action) { admin? || author? }
|
||||
end
|
||||
|
||||
[:create?, :index?, :new?].each do |action|
|
||||
[:show?, :index?, :new?].each do |action|
|
||||
define_method(action) { admin? || teacher? }
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user