Sha256: edd792e902bbfe2dbd426ba6c5029d87b619dcbeee3925ec369c02aa309b6d3b
Contents?: true
Size: 808 Bytes
Versions: 119
Compression:
Stored size: 808 Bytes
Contents
require_dependency "egov_utils/application_controller" module EgovUtils class RolesController < ApplicationController def index authorize! :manage, User authorize! :manage, Group @users = User.all @groups = Group.all end def create entity = params[:entity_class].safe_constantize.try(:find, params[:id]) return render_404 unless entity authorize! :manage, entity entity.roles = params[:roles].map(&:presence).compact if params[:roles].is_a?(Array) if entity.save respond_to do |format| format.json { render json: entity.roles } end else respond_to do |format| format.json { render json: entity.errors.full_messages, status: :unprocessable_entity } end end end end end
Version data entries
119 entries across 119 versions & 1 rubygems