ldap_groups_lookup 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93b710e0c55641a70229aef31de0eb3bcbac110ee8ea7f34e4aea784cd605c74
4
- data.tar.gz: eaa38276bd60526a24ce3979e757cb1423985b71bc05647017ce04a13566ac46
3
+ metadata.gz: 03dc7b2a955c218d89b8f2e50c630c132763812ba9ab49d40d8ec943f1d18ed6
4
+ data.tar.gz: 8e7f97b9c2ecb249ba28878b62f25334439da70b697c158ca632c6856c9fbe01
5
5
  SHA512:
6
- metadata.gz: 5041fe650a03a4a70732df646a1b86e61c28c1c5e366f6254dc156edc6e6a46afb35e315bd7985e90c4097ffb280f1b617e5fe0ea8641d2ff300222e8ec6feb3
7
- data.tar.gz: aee6357c288d1b069a274c7aa413ac8a26170a177d1b269b2ea0d871f4f6c1e77d5a375994a45eadc28159f1e126cc62504db747e5e45cc679a1245835da8707
6
+ metadata.gz: d093962f123dea981ef105d2186d760205671d2f529465bdd1f9c235e03b81c822d37a31e3e057c9ee2c06ef628b6d23fa63c844fe527f4f8792a1ff33017234
7
+ data.tar.gz: c8100e276441ffa86ac707844bc41cb2e199e7acacdcd15cf06c45507c8ccd22ff966222e78b0100e925e40d1724e6557fe9d42596c5bb48a28ba1515c677e98
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['2.7', '3.2']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rake
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # IU LDAP Groups Lookup
2
2
 
3
+ ## Usage
4
+
3
5
  Adds an LDAPGroupsLookup that can be included in a a class to provide an #ldap_groups instance method:
4
6
 
5
- ```
7
+ ```ruby
6
8
  class User
7
9
  attr_accessor :ldap_lookup_key
8
10
  include LDAPGroupsLookup::Behavior
@@ -16,7 +18,7 @@ u.member_of_ldap_group?(['Some-Group'])
16
18
 
17
19
  The LDAP search will be run by the value of #ldap_lookup_key, so your instance object must provide that through some means:
18
20
 
19
- ```
21
+ ```ruby
20
22
  class User < ActiveRecord::Base
21
23
  validates :username, presence: true, uniqueness: true
22
24
  alias_attribute :ldap_lookup_key, :username
@@ -27,3 +29,22 @@ u = User.find_by(username: 'some_username')
27
29
  u.ldap_groups
28
30
  u.member_of_ldap_group?(['Some-Group'])
29
31
  ```
32
+
33
+ ## Configuration
34
+
35
+ Create a file `config/ldap_groups_lookup.yml` that looks like:
36
+
37
+ ```yaml
38
+ :enabled: true
39
+ :host: ads.example.net
40
+ :port: 636
41
+ :auth:
42
+ :method: :simple
43
+ :username: example
44
+ :password: changeme
45
+ :tree: dc=ads,dc=example,dc=net
46
+ :account_ou: ou=Accounts
47
+ :group_ou: ou=Groups
48
+ :member_whitelist:
49
+ - OU=Groups
50
+ ```
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ['lib']
18
18
  gem.required_ruby_version = '>= 2.3.0'
19
+ gem.metadata = { "rubygems_mfa_required" => "true" }
19
20
 
20
21
  gem.add_dependency 'net-ldap'
21
22
  gem.add_development_dependency 'rake'
@@ -9,7 +9,7 @@ module LDAPGroupsLookup
9
9
  def service
10
10
  return nil if config[:enabled] == false
11
11
  if @ldap_service.nil?
12
- @ldap_service = Net::LDAP.new(host: config[:host], auth: config[:auth])
12
+ @ldap_service = Net::LDAP.new(host: config[:host], port: config[:port] || Net::LDAP::DefaultPort, auth: config[:auth])
13
13
  raise Net::LDAP::Error unless @ldap_service.bind
14
14
  end
15
15
  @ldap_service
@@ -55,7 +55,7 @@ module LDAPGroupsLookup
55
55
  if value.nil? || value.is_a?(Hash)
56
56
  @config = value
57
57
  elsif value.is_a?(String)
58
- if File.exists?(value)
58
+ if File.exist?(value)
59
59
  @config = YAML.load(ERB.new(File.read(value)).result)
60
60
  else
61
61
  @config = { enabled: false }
@@ -1,5 +1,5 @@
1
1
  # Gem version release tracking
2
2
  module LDAPGroupsLookup
3
3
  # Define release version
4
- VERSION = '0.7.0'.freeze
4
+ VERSION = '0.8.0'.freeze
5
5
  end
@@ -1,5 +1,6 @@
1
1
  :enabled: true
2
2
  :host: ads.example.net
3
+ :port: 636
3
4
  :auth:
4
5
  :method: :simple
5
6
  :username: example
@@ -28,7 +28,7 @@ RSpec.describe LDAPGroupsLookup do
28
28
  context 'when the config file is missing' do
29
29
  before do
30
30
  allow(LDAPGroupsLookup).to receive(:config).and_call_original
31
- expect(File).to receive(:exists?).with(/config\/ldap_groups_lookup\.yml$/)
31
+ expect(File).to receive(:exist?).with(/config\/ldap_groups_lookup\.yml$/)
32
32
  end
33
33
  it 'should return nil' do
34
34
  expect(LDAPGroupsLookup.service).to be_nil
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldap_groups_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Ploshay
8
8
  - Daniel Pierce
9
9
  - Avalon Media System
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-02-10 00:00:00.000000000 Z
13
+ date: 2024-11-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: net-ldap
@@ -77,9 +77,9 @@ executables: []
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
+ - ".github/workflows/ruby.yml"
80
81
  - ".gitignore"
81
82
  - ".rspec"
82
- - ".travis.yml"
83
83
  - Gemfile
84
84
  - LICENSE
85
85
  - README.md
@@ -95,8 +95,9 @@ files:
95
95
  - spec/spec_helper.rb
96
96
  homepage: http://github.com/IUBLibTech/ldap_groups_lookup
97
97
  licenses: []
98
- metadata: {}
99
- post_install_message:
98
+ metadata:
99
+ rubygems_mfa_required: 'true'
100
+ post_install_message:
100
101
  rdoc_options: []
101
102
  require_paths:
102
103
  - lib
@@ -111,9 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0'
113
114
  requirements: []
114
- rubyforge_project:
115
- rubygems_version: 2.7.6.2
116
- signing_key:
115
+ rubygems_version: 3.5.17
116
+ signing_key:
117
117
  specification_version: 4
118
118
  summary: Provides easy access to the list of LDAP groups a username is a member of.
119
119
  test_files:
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
- - 2.7