app/models/ability.rb in artfully_ose-1.2.0 vs app/models/ability.rb in artfully_ose-1.3.0.pre1

- old
+ new

@@ -1,15 +1,22 @@ class Ability include CanCan::Ability include ArtfullyOse::CommonAbilities def initialize(user) - user ||= User.new - ticketing_abilities_for(user) if user.is_in_organization? - paid_ticketing_abilities_for(user) if user.current_organization.can? :access, :paid_ticketing - person_abilities_for(user) if user.is_in_organization? - household_abilities_for(user) if user.is_in_organization? - order_ablilities_for(user) if user.is_in_organization? - import_ablilities_for(user) if user.is_in_organization? - default_abilities_for(user) + @user = user + + # + # This calls the method for a given permission + # For example, is this user is a manager in this org, then this calls + # the :manager method in CommonAbilities + # + permission = @user.permission_in(@user.current_organization) + + unless permission.blank? + self.send(Permission.database_column_for(permission)) + end + end + + def settlements end end