app/controllers/iugu/settings_controller.rb in iugusdk-1.0.0.alpha.1 vs app/controllers/iugu/settings_controller.rb in iugusdk-1.0.0.alpha.2

- old
+ new

@@ -6,6 +6,20 @@ def index redirect_to :profile_settings, :notice => flash[:notice] end + def must_be (roles, param_name) + access = false + @account_user = AccountUser.find_by_user_id_and_account_id(current_user.id, params[param_name]) + raise ActionController::RoutingError.new("Not Found") unless @account_user + if roles.class == Array + roles.each do |role| + access = true if @account_user.is?(role) + end + else + access = true if @account_user.is?(roles) + end + raise ActionController::RoutingError.new("Access Denied") if access == false + end + end