Sha256: 28bfef94f90b6214a3bbb95a597b4964c0c6dace86ef03bb62b613acf4aab39c

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

# Copyright © 2012 The Pennsylvania State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

class DirectoryController < ApplicationController
  include Hydra::Controller::ControllerBehavior

  # returns true if the user exists and false otherwise
  def user
    render :json => User.directory_attributes(params[:uid])
  end

  def user_attribute
    if params[:attribute] == "groups"
      res = User.groups(params[:uid])
    else
      res = User.directory_attributes(params[:uid], params[:attribute])
    end
    render :json => res
  end

  def user_groups
    render :json => User.groups(params[:uid])
  end

  def group
    Group.exists?(params[:cn])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sufia-0.0.3 app/controllers/directory_controller.rb
sufia-0.0.2 app/controllers/directory_controller.rb
sufia-0.0.1 app/controllers/directory_controller.rb
sufia-0.0.1.pre2 app/controllers/directory_controller.rb
sufia-0.0.1.pre1 app/controllers/directory_controller.rb