add role teacher to application_policy, implement teacher into team_policy

This commit is contained in:
yqbk
2016-05-31 17:40:00 +02:00
parent 9b07a68e3a
commit 8896a3aa18
3 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,11 @@ class ApplicationPolicy
end
private :admin?
def teacher?
@user.teacher?
end
private :teacher?
def everyone
true
end

View File

@ -1,6 +1,6 @@
class TeamPolicy < ApplicationPolicy
[:create?, :index?, :new?].each do |action|
define_method(action) { admin? }
define_method(action) { admin? || teacher? }
end
[:destroy?, :edit?, :show?, :update?].each do |action|

View File

@ -1,4 +1,4 @@
class Xikolo::3Client
class Xikolo::Client
def self.get_user(user_id)
params = {:user_id => user_id}
response = get_request(user_profile_url(user_id), params)
@ -56,4 +56,4 @@ class Xikolo::3Client
def self.authentication_url
return @url + 'authenticate'
end
end
end