summaryrefslogtreecommitdiff
path: root/app/models/ability.rb
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-06 03:44:43 -0500
committerPeter Kozak <spag@golwen.net>2013-03-06 03:44:43 -0500
commit860b346781a5c7508ad0158d26f34454be810860 (patch)
tree1dfca5637341459ac1a02817c4ae91104d1d4d38 /app/models/ability.rb
parent134150c4f6b1f0a50c837e00a3c2bbe186dfb14e (diff)
ringtone and call_forward abilities fixed
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r--app/models/ability.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 48cce84..3cd1d4d 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -134,9 +134,6 @@ class Ability
can :read, SipAccount, :sip_accountable_type => 'User', :sip_accountable_id => user.id
user.sip_accounts.each do |sip_account|
can :read, PhoneNumber, :id => sip_account.phone_number_ids
- can :manage, CallForward, :call_forwardable_id => sip_account.phone_number_ids
- can :manage, Ringtone, :ringtoneable_type => 'PhoneNumber', :ringtoneable_id => sip_account.phone_number_ids
- can :manage, Ringtone, :ringtoneable_type => 'SipAccount', :ringtoneable_id => sip_account.id
can [:read, :destroy, :call] , CallHistory, :id => sip_account.call_history_ids
end
can :read, Phone, :phoneable_type => 'User', :phoneable_id => user.id
@@ -161,10 +158,17 @@ class Ability
can :manage, ConferenceInvitee, :conference_id => conference.id
end
- # User can manage CallForwards of the PhoneNumbers of his
- # own SipAccounts:
+ # User can manage CallForwards of its SipAccount and PhoneNumbers
#
- can :manage, CallForward, :call_forwardable_id => user.phone_number_ids
+ can :manage, CallForward, :call_forwardable_type => 'PhoneNumber', :call_forwardable_id => user.phone_number_ids
+ can :manage, CallForward, :call_forwardable_type => 'SipAccount', :call_forwardable_id => user.sip_account_ids
+ can :create, CallForward
+
+ # User can manage Ringtones of its SipAccount and PhoneNumbers
+ #
+ can :manage, Ringtone, :ringtoneable_type => 'PhoneNumber', :ringtoneable_id => user.phone_number_ids
+ can :manage, Ringtone, :ringtoneable_type => 'SipAccount', :ringtoneable_id => user.sip_account_ids
+ can :create, Ringtone
# SoftkeyFunctions
#