Sha256: d4209993d84b6248377f3e2f698e209e41583e5b11462b3f3da0734031ad4798
Contents?: true
Size: 908 Bytes
Versions: 1
Compression:
Stored size: 908 Bytes
Contents
#!/usr/bin/env ruby require 'cratus' include Cratus LDAP.connect # Read in arguments group_mapping_arg = ARGV[0] raise "Missing Group Mapping Argument!" unless group_mapping_arg group_mapping_file = File.expand_path(group_mapping_arg) raise "Invalid Group Mapping File #{group_mapping_file}" unless File.readable?(group_mapping_file) # Load the YAML file(s) for mapping permissions group_permissions = YAML.load_file(group_mapping_file) # Gather group memberships and permissions @results = {} # stash all the results here... might get really big User.all.sort.each do |user| key = user.username.to_s user_groups = user.member_of.map { |g| g.name.to_s } @results[key] = {'groups' => {}} user_groups.sort.each do |ugroup| group_perm_set = group_permissions[ugroup] ? group_permissions[ugroup].sort : [] @results[key]['groups'][ugroup] = group_perm_set end end puts @results.to_yaml
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cratus-0.2.1 | bin/cratus |