mconf/mconf-web

View on GitHub
app/models/abilities.rb

Summary

Maintainability
A
0 mins
Test Coverage
# This file is part of Mconf-Web, a web application that provides access
# to the Mconf webconferencing system. Copyright (C) 2010-2015 Mconf.
#
# This file is licensed under the Affero General Public License version
# 3 or later. See the LICENSE file.

# Based on https://gist.github.com/3729390/

require 'abilities/base_ability'
require 'abilities/anonymous_ability'
require 'abilities/member_ability'
require 'abilities/superuser_ability'

module Abilities

  def self.ability_for(user)
    if user && user.superuser?
      SuperUserAbility.new(user)
    elsif user && !user.anonymous?
      MemberAbility.new(user)
    else
      AnonymousAbility.new
    end
  end

end