app/controllers/iugu/account_roles_controller.rb in iugusdk-1.0.0.alpha.1 vs app/controllers/iugu/account_roles_controller.rb in iugusdk-1.0.0.alpha.2
- old
+ new
@@ -1,14 +1,11 @@
class Iugu::AccountRolesController < Iugu::SettingsController
+ before_filter(:only => [:edit, :update]) { |c| c.must_be [:owner, :admin], :id }
+
def edit
@account = current_user.accounts.find(params[:id])
@account_user = @account.account_users.find_by_user_id(params[:user_id])
- if current_user.is?(:owner, @account) || current_user.is?(:admin, @account)
- render 'iugu/account_roles/edit'
- else
- render :file => "#{Rails.root}/public/422.html", :status => 550
- end
end
def update
@account = current_user.accounts.find(params[:id])
@account_user = @account.account_users.find_by_user_id(params[:user_id])