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 +4 -4
- data/bin/ldaptools +1 -1
- data/lib/tapjoy/ldap/group/remove_user.rb +44 -0
- data/lib/tapjoy/ldap/group.rb +8 -2
- data/lib/tapjoy/ldap/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47ce6da6cc59b2ea41e4d71fe018c47192656890
|
4
|
+
data.tar.gz: 5bc79da1dbd705cb59e5c063cce6b63dff344d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae18a23dbb82805088807992b94c1ea84702ece71a184aa4767375c9d9d02e8de868d714535ab97d6c08bc49da70854235e0b103207605880b68dd3f32fa837
|
7
|
+
data.tar.gz: 419dd11a33e45b8bd4e07758b7e12b7ea602469d0391b29dbc4335b693f73bb47da7a0082f9523b27de5ea589b57b2b8e314955ad4a9b75fc185ed698fd411eb
|
data/bin/ldaptools
CHANGED
@@ -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
|
data/lib/tapjoy/ldap/group.rb
CHANGED
@@ -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
|
data/lib/tapjoy/ldap/version.rb
CHANGED
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.
|
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-
|
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.
|
116
|
+
rubygems_version: 2.5.1
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
119
|
summary: Tapjoy LDAP Tools
|