ldap_tools 0.7.0 → 0.7.1

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
  SHA1:
3
- metadata.gz: f894e92c9563dc83bc4e24235ef08e382dc96e64
4
- data.tar.gz: 3f7928ffa4b11dd4a37fb4ba2aad8fca15a4fc3b
3
+ metadata.gz: 47ce6da6cc59b2ea41e4d71fe018c47192656890
4
+ data.tar.gz: 5bc79da1dbd705cb59e5c063cce6b63dff344d31
5
5
  SHA512:
6
- metadata.gz: ab06edf1ce374f42a01e869e9f4ad032391ed3f5af1df93ee5d56ab9b9081dd8e9691b24a504e0852d075576b6ec0ba85ff1091649ead9542428af70c331bdad
7
- data.tar.gz: 730e30088bc5f6775d6f2e32f12baf4608b1832d4fb4f92c52ca4682fd256f2f6074e28e29595c8fa331209d8a4c926616fdd9068829ef961c2805a7f2b5d15e
6
+ metadata.gz: bae18a23dbb82805088807992b94c1ea84702ece71a184aa4767375c9d9d02e8de868d714535ab97d6c08bc49da70854235e0b103207605880b68dd3f32fa837
7
+ data.tar.gz: 419dd11a33e45b8bd4e07758b7e12b7ea602469d0391b29dbc4335b693f73bb47da7a0082f9523b27de5ea589b57b2b8e314955ad4a9b75fc185ed698fd411eb
data/bin/ldaptools CHANGED
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  cmd = ARGV.shift # get the subcommand
22
22
  case cmd
23
- when "user" # run commands associated with user object
23
+ when 'user' # run commands associated with user object
24
24
  Tapjoy::LDAP::User.commands
25
25
  when 'group'
26
26
  Tapjoy::LDAP::Group.commands
@@ -0,0 +1,44 @@
1
+ module Tapjoy
2
+ module LDAP
3
+ module Group
4
+ # Remove existing user to existing group
5
+ class RemoveUser
6
+ def remove_user
7
+ confirm unless opts[:force]
8
+ puts Tapjoy::LDAP::client.modify(distinguished_name, operations)
9
+ end
10
+
11
+ private
12
+ def opts
13
+ @opts ||= Trollop::options do
14
+ # Set help message
15
+ usage 'group remove_user [options]'
16
+ synopsis "\nThis command is for removing existing users from existing groups"
17
+
18
+ opt(:group, 'Specify group', :type => :string, :required => true)
19
+ opt(:username, 'Specify username', :type => :string, :required => true)
20
+ end
21
+ end
22
+
23
+ def distinguished_name
24
+ @distinguished_name ||= "cn=#{opts[:group]},ou=Group,#{Tapjoy::LDAP::client.basedn}"
25
+ end
26
+
27
+ def operations
28
+ # Format is LDAP operation, attribute modified, value modified
29
+ # i.e, remove the username to the memberuid attribute for the specified group
30
+ @operations ||= [[:delete, :memberUid, opts[:username]]]
31
+ end
32
+
33
+ def confirm
34
+ puts "Confirm that you want to remove user #{opts[:username]} from group #{opts[:group]} (yes/no)"
35
+ print '>'
36
+ confirm = STDIN.gets.chomp().downcase
37
+ unless confirm.eql?('y') || confirm.eql?('yes')
38
+ abort("Deletion of #{ opts[:name] } aborted")
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,6 +1,7 @@
1
1
  require_relative 'group/create'
2
2
  require_relative 'group/delete'
3
3
  require_relative 'group/add_user'
4
+ require_relative 'group/remove_user'
4
5
 
5
6
  module Tapjoy
6
7
  module LDAP
@@ -8,7 +9,7 @@ module Tapjoy
8
9
  module Group
9
10
  class << self
10
11
 
11
- SUB_COMMANDS = %w(create delete add_user)
12
+ SUB_COMMANDS = %w(create delete add_user remove_user)
12
13
 
13
14
  def commands
14
15
  Trollop::options do
@@ -21,7 +22,7 @@ module Tapjoy
21
22
  cmd = ARGV.shift
22
23
 
23
24
  case cmd
24
- when 'create', 'delete', 'add_user'
25
+ when 'create', 'delete', 'add_user', 'remove_user'
25
26
  send(cmd) # call method with respective name
26
27
  else
27
28
  raise Tapjoy::LDAP::InvalidArgument
@@ -65,6 +66,11 @@ module Tapjoy
65
66
  group = Tapjoy::LDAP::Group::AddUser.new
66
67
  group.add_user
67
68
  end
69
+
70
+ def remove_user
71
+ group = Tapjoy::LDAP::Group::RemoveUser.new
72
+ group.remove_user
73
+ end
68
74
  end
69
75
  end
70
76
  end
@@ -3,7 +3,7 @@ module Tapjoy
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 7
6
- PATCH = 0
6
+ PATCH = 1
7
7
  end
8
8
 
9
9
  VERSION = [Version::MAJOR, Version::MINOR, Version::PATCH].join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldap_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ali Tayarani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
@@ -83,6 +83,7 @@ files:
83
83
  - lib/tapjoy/ldap/group/add_user.rb
84
84
  - lib/tapjoy/ldap/group/create.rb
85
85
  - lib/tapjoy/ldap/group/delete.rb
86
+ - lib/tapjoy/ldap/group/remove_user.rb
86
87
  - lib/tapjoy/ldap/key.rb
87
88
  - lib/tapjoy/ldap/key/add.rb
88
89
  - lib/tapjoy/ldap/key/install.rb
@@ -112,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  version: '0'
113
114
  requirements: []
114
115
  rubyforge_project:
115
- rubygems_version: 2.2.2
116
+ rubygems_version: 2.5.1
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: Tapjoy LDAP Tools