1 |
class NZIC::InfoPolicy < AuthenticatedPolicy |
× |
2 |
|
× |
3 |
class Scope < ApplicationPolicy::Scope |
× |
4 |
def resolve |
× |
5 |
if user.is_any?([:superadmin, :NZIC_webmaster]) |
× |
6 |
scope.all |
× |
7 |
else
|
× |
8 |
scope.none |
× |
9 |
end
|
× |
10 |
end
|
× |
11 |
end
|
× |
12 |
|
× |
13 |
def index? |
× |
14 |
manage? |
× |
15 |
end
|
× |
16 |
|
× |
17 |
def manage? |
× |
18 |
user.is_any?([:superadmin, :NZIC_webmaster]) |
× |
19 |
end
|
× |
20 |
|
× |
21 |
def show? |
× |
22 |
manage? |
× |
23 |
end
|
× |
24 |
|
× |
25 |
def update? |
× |
26 |
manage? |
× |
27 |
end
|
× |
28 |
|
× |
29 |
def edit? |
× |
30 |
update? |
× |
31 |
end
|
× |
32 |
|
× |
33 |
def destroy? |
× |
34 |
manage? |
× |
35 |
end
|
× |
36 |
|
× |
37 |
def create? |
× |
38 |
manage? |
× |
39 |
end
|
× |
40 |
|
× |
41 |
def new? |
× |
42 |
create? |
× |
43 |
end
|
× |
44 |
end
|
× |
45 |
|
× |