diff options
-rw-r--r-- | app/controllers/fax_accounts_controller.rb | 5 | ||||
-rw-r--r-- | app/models/fax_account.rb | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/fax_accounts_controller.rb b/app/controllers/fax_accounts_controller.rb index 031080e..804cdb9 100644 --- a/app/controllers/fax_accounts_controller.rb +++ b/app/controllers/fax_accounts_controller.rb @@ -1,7 +1,8 @@ class FaxAccountsController < ApplicationController load_resource :user + load_resource :tenant load_resource :user_group - load_and_authorize_resource :fax_account, :through => [:user, :user_group] + load_and_authorize_resource :fax_account, :through => [:user, :user_group, :tenant] before_filter :set_and_authorize_parent before_filter :spread_breadcrumbs @@ -54,7 +55,7 @@ class FaxAccountsController < ApplicationController private def set_and_authorize_parent - @parent = @user || @user_group + @parent = @user || @user_group || @tenant authorize! :read, @parent end diff --git a/app/models/fax_account.rb b/app/models/fax_account.rb index 683447a..2677c5d 100644 --- a/app/models/fax_account.rb +++ b/app/models/fax_account.rb @@ -49,6 +49,7 @@ class FaxAccount < ActiveRecord::Base tenant = case self.fax_accountable_type when 'UserGroup' ; fax_accountable.tenant when 'User' ; fax_accountable.current_tenant || fax_accountable.tenants.last + when 'Tenant' ; fax_accountable else nil end self.tenant_id = tenant.id if tenant != nil |