forked from consuldemocracy/consuldemocracy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
administrator.rb
110 lines (80 loc) · 3.95 KB
/
administrator.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
module Abilities
class Administrator
include CanCan::Ability
def initialize(user)
merge Abilities::Moderation.new(user)
can :restore, Comment
cannot :restore, Comment, hidden_at: nil
can :restore, Debate
cannot :restore, Debate, hidden_at: nil
can :restore, Proposal
cannot :restore, Proposal, hidden_at: nil
can :create, Legislation::Proposal
can :show, Legislation::Proposal
can :proposals, ::Legislation::Process
can :restore, Legislation::Proposal
cannot :restore, Legislation::Proposal, hidden_at: nil
can :restore, Budget::Investment
cannot :restore, Budget::Investment, hidden_at: nil
can :restore, User
cannot :restore, User, hidden_at: nil
can :confirm_hide, Comment
cannot :confirm_hide, Comment, hidden_at: nil
can :confirm_hide, Debate
cannot :confirm_hide, Debate, hidden_at: nil
can :confirm_hide, Proposal
cannot :confirm_hide, Proposal, hidden_at: nil
can :confirm_hide, Legislation::Proposal
cannot :confirm_hide, Legislation::Proposal, hidden_at: nil
can :confirm_hide, Budget::Investment
cannot :confirm_hide, Budget::Investment, hidden_at: nil
can :confirm_hide, User
cannot :confirm_hide, User, hidden_at: nil
can :mark_featured, Debate
can :unmark_featured, Debate
can :comment_as_administrator, [Debate, Comment, Proposal, Poll::Question, Budget::Investment,
Legislation::Question, Legislation::Proposal, Legislation::Annotation, Topic]
can [:search, :create, :index, :destroy, :edit, :update], ::Administrator
can [:search, :create, :index, :destroy], ::Moderator
can [:search, :show, :edit, :update, :create, :index, :destroy, :summary], ::Valuator
can [:search, :create, :index, :destroy], ::Manager
can [:search, :index], ::User
can :manage, Dashboard::Action
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget
can [:read, :create, :update, :destroy], Budget::Group
can [:read, :create, :update, :destroy], Budget::Heading
can [:hide, :admin_update, :toggle_selection], Budget::Investment
can [:valuate, :comment_valuation], Budget::Investment
cannot [:admin_update, :toggle_selection, :valuate, :comment_valuation],
Budget::Investment, budget: { phase: "finished" }
can :create, Budget::ValuatorAssignment
can :read_admin_stats, Budget, &:balloting_or_later?
can [:search, :edit, :update, :create, :index, :destroy], Banner
can [:index, :create, :edit, :update, :destroy], Geozone
can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers, :booth_assignments, :results, :stats], Poll
can [:read, :create, :update, :destroy, :available], Poll::Booth
can [:search, :create, :index, :destroy], ::Poll::Officer
can [:create, :destroy, :manage], ::Poll::BoothAssignment
can [:create, :destroy], ::Poll::OfficerAssignment
can [:read, :create, :update], Poll::Question
can :destroy, Poll::Question
can :manage, SiteCustomization::Page
can :manage, SiteCustomization::Image
can :manage, SiteCustomization::ContentBlock
can :access, :ckeditor
can :manage, Ckeditor::Picture
can [:manage], ::Legislation::Process
can [:manage], ::Legislation::DraftVersion
can [:manage], ::Legislation::Question
can [:manage], ::Legislation::Proposal
cannot :comment_as_moderator, [::Legislation::Question, Legislation::Annotation, ::Legislation::Proposal]
can [:create], Document
can [:destroy], Document, documentable_type: "Poll::Question::Answer"
can [:create, :destroy], DirectUpload
can [:deliver], Newsletter, hidden_at: nil
can [:manage], Dashboard::AdministratorTask
can :manage, LocalCensusRecord
can [:create, :read], LocalCensusRecords::Import
end
end
end