JGrouper - JRuby wrapper around the Internet2 Grouper API

Usage

API

require 'jgrouper'
JGrouper.home! '/path/to/your/grouper/api/installation/directory'

Groups

# Find Group by name
g = JGrouper::Group.find $name

# Grant privileges
g.grant JGrouper::Subject.find($subj), JGrouper::Privilege.find('admin')

Members

# Find Member by UUID
m = JGrouper::Member.find $uuid

Privileges

# Find Privilege by name
p = JGrouper::Privilege.find 'admin'
p.access? # True
p.naming? # False
p.type    # :access

Stems

# Find root stem
root = JGrouper::Stem.root

# Child stems
root.stems

# Child Groups
root.groups

# Find stem by name
stem = JGrouper::Stem.find $name

# Grant privileges
stem.grant JGrouper::Subject.find($subj), JGrouper::Privilege.find('stem')

Subjects

# Find by id-or-identifier
subj = JGrouper::Subject.find $subj

Archiver

require 'jgrouper/audit_archiver'

JGrouper::AuditArchiver.new do |archiver|
  # Write output to this directory
  archiver.directory     = '/some/directory'

  # Archive this many days of audit log entries
  archive.number_of_days = 5

  # Omit these columns from the archive
  archiver.skip_columns  = %w( duration_microseconds hibernate_version_number query_count )

  # Do not archive from this date onward.
  archiver.stop_date     = '2013-01-01'

  # Perform archive, optionally yielding audit log entries being archived if block given
  archiver.archive { |entry| ... audit log entry being archived ... }
end

Scripts

Archive Grouper audit log entries to disk:

% jgrouper-audit-archiver -h

Export (some of the) Groups registry to CSV:

% jgrouper-exporter -h

Grant privileges:

% jgrouper-grant $group admin $subject
% jgrouper-grant $stem stem $subject
% jgrouper-grant -R $stem admin $subject
% jgrouper-grant -R $stem stem $subject

Installation

Add this line to your application’s Gemfile:

gem 'jgrouper'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jgrouper

Contributing

  1. Fork it

  2. Create your feature branch (+git checkout -b my-new-feature+)

  3. Commit your changes (+git commit -am ‘Added some feature’+)

  4. Push to the branch (+git push origin my-new-feature+)

  5. Create new Pull Request

Author

blair christensen. <[email protected]>

Home Page

github.com/blairc/jgrouper/

See Also

grouper.internet2.edu