Sha256: 74d9dd09fdbd1baa7876a5775a39a5a99811d324bb7d554a9f7981eef6f31fdd

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

##
# This is the controller that allows managing the access groups used for authorizing access to resources.
#
class AccessGroupsController < ApplicationController
  before_action :validate_user
  before_action :set_access_group, only: [:show, :edit, :update, :destroy]

  ##
  # GET /access_groups
  def index
    @access_groups = AccessGroup.all.sorted
  end

  ##
  # GET /access_groups/1
  def show
  end

  ##
  # GET /access_groups/new
  def new
    @access_group = AccessGroup.new
  end

  ##
  # GET /access_groups/1/edit
  def edit
  end

  ##
  # POST /access_groups
  def create
    @access_group = AccessGroup.new(access_group_params)

    if @access_group.save
      redirect_to access_groups_url, notice: 'Access group was successfully created.'
    else
      render :new
    end
  end

  ##
  # PATCH/PUT /access_groups/1
  def update
    if @access_group.update(access_group_params)
      redirect_to access_groups_url, notice: 'Access group was successfully updated.'
    else
      render :edit
    end
  end

  ##
  # DELETE /access_groups/1
  def destroy
    @access_group.destroy
    redirect_to access_groups_url, notice: 'Access group was successfully destroyed.'
  end

  private

  def validate_user
    authorize! true
  end

  # Use callbacks to share common setup or constraints between actions.
  def set_access_group
    @access_group = AccessGroup.find(params[:id])
  end

  # Only allow a trusted parameter "white list" through.
  def access_group_params
    params.require(:access_group).permit(:name, :ldap_group_list)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
barkest_core-1.5.4.0 app/controllers/access_groups_controller.rb
barkest_core-1.5.3.0 app/controllers/access_groups_controller.rb