1 |
class ItemPolicy < AuthenticatedPolicy |
× |
2 |
|
× |
3 |
class Scope < ApplicationPolicy::Scope |
× |
4 |
def resolve |
× |
5 |
if user.has_role?(:superadmin) |
× |
6 |
scope.all |
× |
7 |
else
|
× |
8 |
scope.none |
× |
9 |
end
|
× |
10 |
end
|
× |
11 |
end
|
× |
12 |
|
× |
13 |
def index? |
× |
14 |
user.has_role?(:superadmin)
|
× |
15 |
end
|
× |
16 |
|
× |
17 |
def manage? |
× |
18 |
user.has_role?(:superadmin)
|
× |
19 |
end
|
× |
20 |
|
× |
21 |
def inspect? |
× |
22 |
manage? |
× |
23 |
end
|
× |
24 |
|
× |
25 |
def show? |
× |
26 |
manage? |
× |
27 |
end
|
× |
28 |
end
|
× |
29 |
|
× |