This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some basic system info | |
Python 2.6.6 | |
OpenSrf svn checkout from 11/30/2010 | |
> uname -a | |
Linux capstest 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux | |
>cat /etc/lsb-release | |
DISTRIB_ID=Ubuntu | |
DISTRIB_RELEASE=10.10 | |
DISTRIB_CODENAME=maverick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.fits_to_desc_mapping = { | |
:format_label => :format, | |
:last_modified => :date_modified, | |
:original_checksum => :identifier, | |
:rights_basis => :rights, | |
:copyright_basis => :rights, | |
:copyright_note => :rights, | |
:file_title => :title, | |
:file_author => :creator, | |
:file_language => :language |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 # Groups that user is a member of | |
39 def groups | |
40 #Hydra::LDAP.groups_for_user(login + ",dc=psu,dc=edu") | |
41 return ["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"] | |
42 end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
no worky | |
<%= f.select "resource_type", options_for_select(ScholarSphere::Application::config.resource_types, @generic_file.resource_type), {}, {:multiple=>true, :size=>7} %> | |
worky | |
<%= f.select "resource_type", options_for_select(ScholarSphere::Application::config.resource_types, [@generic_file.resource_type.first, @generic_file.resource_type.last]), {}, {:multiple=>true, :size=>7} %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hydra | |
module Datastream | |
class RightsMetadata < ActiveFedora::NokogiriDatastream | |
# Updates permissions for all of the persons and groups in a hash | |
# @param params ex. {"group"=>{"group1"=>"discover","group2"=>"edit"}, "person"=>{"person1"=>"read","person2"=>"discover"}} | |
# Currently restricts actor type to group or person. Any others will be ignored | |
def update_permissions(params) | |
params.fetch("group", {}).each_pair {|group_id, access_level| self.permissions({"group"=>group_id}, access_level)} | |
#params.fetch("person", {}).each_pair {|group_id, access_level| self.permissions({"person"=>group_id}, access_level)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_tag catalog_index_path, :method => :get, :id => "search-form-header" do %> | |
<%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %> | |
<%= text_field_tag :q, params[:q] unless params[:q] == 'dashboard'?, :class => "q", :id => "search-field-header", :placeholder => "Type keywords in here" %> | |
<%= params[:controller] %> | |
<%= submit_tag 'Go', :id=>'search-submit-header' %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Contact Form</h1> | |
<%= form_for(@contact_form, :html => {:class => 'form-horizontal well'}) do |f| %> | |
<%= f.label :name, 'Name', :class=>"control-label" %> | |
<div class="controls"> | |
<%= f.text_field :name, :class=>"controls", :value=>"", :required => false %> | |
<%= f.submit :value => "Send", :class => "btn-primary btn-large" %> | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe DirectoryController do | |
describe "#user" do | |
it "should return an empty array for non-existing user" do | |
get :user, uid:"noone" | |
response.should == [] #be_empty | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# returns true if the user exists and false otherwise | |
def user | |
render :json => User.attributes(params[:uid]) | |
end | |
def user_attribute | |
if params[:attribute] == "groups" | |
res = User.groups(params[:uid]) | |
else | |
res = User.attributes(params[:uid], params[:attribute]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper'require 'ladle' | |
describe 'Ldap service' do | |
before(:all) do | |
@ldap_server = Ladle::Server.new( :port => 3897, | |
:domain => "dc=example,dc=org", :allow_anonymous => true, | |
:verbose => true, | |
:ldif => 'default.ldif' | |
).start | |
end |
OlderNewer