class ASF::Authorization
parse the -authorization-template
files contained within infrastructure-puppet/modules/subversion_server/files/authorization
Constants
- PUPPET_DATA
N.B. This data is maintained by a cron job on the Whimsy server, which has access
- PUPPET_PATH
Public Class Methods
find_by_id(value)
click to toggle source
Return the set of authorizations a given user (availid) has access to.
# File lib/whimsy/asf/auth.rb, line 13 def self.find_by_id(value) new.select {|_auth, ids| ids.include? value}.map(&:first) end
new(file='asf', auth_path=nil)
click to toggle source
Select a given -authorization-template
, valid values are asf
and pit
. The optional auth_path
parameter allows the directory path to be overridden This is intended for testing only
# File lib/whimsy/asf/auth.rb, line 21 def initialize(file='asf', auth_path=nil) raise ArgumentError("Invalid file: #{file}") unless %w(asf pit).include? file if auth_path require 'wunderbar' Wunderbar.warn "Overriding Git infrastructure-puppet auth path as: #{auth_path}" @auth = auth_path else @auth = PUPPET_PATH end @file = file end
Public Instance Methods
each() { |pmc, ids| ... }
click to toggle source
Iteratively return each non_LDAP entry in the authorization file as a pair of values: a name and list of ids.
# File lib/whimsy/asf/auth.rb, line 35 def each # extract the xxx={auth} names groups = read_auth.scan(/^([-\w]+)=\{auth\}/).flatten # extract the group = list details and return the appropriate ones read_conf.each do |pmc, ids| yield pmc, ids if groups.include? pmc end end
path()
click to toggle source
Return the auth path used to find asf-auth and pit-auth
# File lib/whimsy/asf/auth.rb, line 45 def path @auth end