2016-10-04 14:51:21 +00:00
|
|
|
# frozen_string_literal: true
|
2016-10-04 14:24:47 +00:00
|
|
|
class UserPolicy < ApplicationPolicy
|
|
|
|
def index?
|
2016-10-04 14:51:21 +00:00
|
|
|
true
|
2016-10-04 14:24:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def show?
|
2016-10-04 14:51:21 +00:00
|
|
|
true
|
2016-10-04 14:24:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create?
|
2016-10-04 14:51:21 +00:00
|
|
|
raise 'Create should be handled by Devise'
|
2016-10-04 14:24:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update?
|
|
|
|
user == record
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def details?
|
|
|
|
show?
|
|
|
|
end
|
|
|
|
|
|
|
|
def updatemetacodes?
|
|
|
|
update?
|
|
|
|
end
|
|
|
|
|
|
|
|
# API action
|
|
|
|
def current?
|
|
|
|
user == record
|
|
|
|
end
|
|
|
|
|
|
|
|
class Scope < Scope
|
|
|
|
def resolve
|
2016-10-04 14:51:21 +00:00
|
|
|
scope.all
|
2016-10-04 14:24:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|