Sha256: 6f7d0b0ab0eb668fb0de070fbdccbd0e35f1054345d9e2742e3090e978e45162

Contents?: true

Size: 1.33 KB

Versions: 26

Compression:

Stored size: 1.33 KB

Contents

require_dependency "egov_utils/application_controller"

module EgovUtils
  class GroupsController < ApplicationController

    load_and_authorize_resource

    def index
      @groups = EgovUtils::Group.accessible_by(current_ability)
    end

    def show
    end

    def create
      respond_to do |format|
        if @group.save
          format.html{ redirect_to egov_utils.users_path, notice: t('success_created') }
          format.json{ render json: @group, status: :created }
        else
          format.html{ render 'new' }
          format.json{ render json: @group.errors.full_messages, status: :unprocessable_entity }
        end
      end
    end

    def new_users
      @principals = EgovUtils::User.active.assignable_to_group(@group)
      respond_to do |format|
        format.html
        format.js { render_modal_js }
      end
    end

    def add_users
      render_404 and return unless @group.allow_member_assign?
      @users = User.active.assignable_to_group(@group).where(:id => (params[:user_id] || params[:user_ids])).to_a
      @group.users << @users
      respond_to do |format|
        format.html { redirect_to group_path(@group) }
        format.json { head :ok }
      end
    end

    private

      def create_params
        params.require(:group).permit(:name, :provider, :ldap_uid, :external_uid)
      end

  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
egov_utils-1.1.1 app/controllers/egov_utils/groups_controller.rb
egov_utils-1.1.0 app/controllers/egov_utils/groups_controller.rb
egov_utils-1.0.3 app/controllers/egov_utils/groups_controller.rb
egov_utils-1.0.2 app/controllers/egov_utils/groups_controller.rb
egov_utils-1.0.1 app/controllers/egov_utils/groups_controller.rb
egov_utils-1.0.0 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.7.5 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.7.4 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.7.3 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.7.2 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.7.1 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.7.0 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.6.5 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.6.4 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.6.3 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.6.2 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.6.1 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.6.0 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.5.2 app/controllers/egov_utils/groups_controller.rb
egov_utils-0.5.1 app/controllers/egov_utils/groups_controller.rb