The current tracking section had a few issues: * When browsing as an admin, this section becomes useless since no investments are shown * Browsing investments in the admin section, you're suddenly redirected to the tracking section, making navigation confusing * One test related to the officing dashboard failed due to these changes and had been commented * Several views and controller methods were copied from other sections, leading to duplication and making the code harder to maintain * Tracking routes were defined for proposals and legislation processes, but in the tracking section only investments were shown * Probably many more things, since these issues were detected after only an hour reviewing and testing the code So we're removing this untested section before releasing version 1.1. We might add it back afterwards.
26 lines
653 B
Ruby
26 lines
653 B
Ruby
class Ability
|
|
include CanCan::Ability
|
|
|
|
def initialize(user)
|
|
# If someone can hide something, he can also hide it
|
|
# from the moderation screen
|
|
alias_action :hide_in_moderation_screen, to: :hide
|
|
|
|
if user # logged-in users
|
|
merge Abilities::Valuator.new(user) if user.valuator?
|
|
|
|
if user.administrator?
|
|
merge Abilities::Administrator.new(user)
|
|
elsif user.moderator?
|
|
merge Abilities::Moderator.new(user)
|
|
elsif user.manager?
|
|
merge Abilities::Manager.new(user)
|
|
else
|
|
merge Abilities::Common.new(user)
|
|
end
|
|
else
|
|
merge Abilities::Everyone.new(user)
|
|
end
|
|
end
|
|
end
|