Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
isgphys
python
Commits
c19d3ce8
Commit
c19d3ce8
authored
4 years ago
by
Sven Mäder
Browse files
Options
Downloads
Patches
Plain Diff
Add missing opts to list members only
parent
4c685c00
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/showgroup.py
+25
-7
25 additions, 7 deletions
bin/showgroup.py
with
25 additions
and
7 deletions
bin/showgroup.py
+
25
−
7
View file @
c19d3ce8
...
@@ -20,13 +20,20 @@ NOOPTS = collections.OrderedDict()
...
@@ -20,13 +20,20 @@ NOOPTS = collections.OrderedDict()
NOOPTS
[
'
no-member
'
]
=
'
memberUid
'
NOOPTS
[
'
no-member
'
]
=
'
memberUid
'
NOOPTS
[
'
no-gid
'
]
=
'
gidNumber
'
NOOPTS
[
'
no-gid
'
]
=
'
gidNumber
'
NOOPTS
[
'
no-owner
'
]
=
'
owner
'
NOOPTS
[
'
no-owner
'
]
=
'
owner
'
NOOPTS
[
'
no-uid
'
]
=
'
uidNumber
'
NOOPTS
[
'
no-name
'
]
=
'
gecos
'
def
main
():
def
main
():
description
=
'
Show groups or group members
'
description
=
'
Show groups or group members
'
arg
=
'
group
'
arg
=
'
group
'
arg_help
=
'
The group name (cn), or wildcards (*, cn* , *cn*)
'
arg_help
=
'
The group name (cn), or wildcards (*, cn* , *cn*)
'
args
=
argparser
.
simple
(
description
,
arg
=
arg
,
arg_help
=
arg_help
,
opts
=
OPTS
,
noopts
=
NOOPTS
)
parser
=
argparser
.
extendable
(
description
,
arg
=
arg
,
arg_help
=
arg_help
,
opts
=
OPTS
,
noopts
=
NOOPTS
)
parser
.
add_argument
(
'
--uids
'
,
dest
=
'
uid_only
'
,
action
=
'
store_const
'
,
const
=
True
,
help
=
'
Show uids only
'
)
parser
.
add_argument
(
'
--names
'
,
dest
=
'
name_only
'
,
action
=
'
store_const
'
,
const
=
True
,
help
=
'
Show real names only
'
)
args
=
vars
(
parser
.
parse_args
())
ldap
=
dphysldap
.
Ldap
()
ldap
=
dphysldap
.
Ldap
()
...
@@ -50,23 +57,34 @@ def main():
...
@@ -50,23 +57,34 @@ def main():
group
=
groups
[
0
]
group
=
groups
[
0
]
members
=
group
[
'
memberUid
'
]
members
=
group
[
'
memberUid
'
]
print
(
'
Group {} ({}):
'
.
format
(
group
[
'
cn
'
],
group
[
'
gidNumber
'
]))
if
not
args
[
'
name_only
'
]
and
not
args
[
'
uid_only
'
]:
print
(
'
Owner: {}
'
.
format
(
group
[
'
owner
'
]))
print
(
'
Group {} ({}):
'
.
format
(
group
[
'
cn
'
],
group
[
'
gidNumber
'
]))
print
(
'
Report: {}
'
.
format
(
group
[
'
reportEnabled
'
]))
print
(
'
Owner: {}
'
.
format
(
group
[
'
owner
'
]))
print
(
'
Reported to: {}
'
.
format
(
group
[
'
reportUid
'
]))
print
(
'
Report: {}
'
.
format
(
group
[
'
reportEnabled
'
]))
print
(
'
Reported to: {}
'
.
format
(
group
[
'
reportUid
'
]))
if
members
:
if
members
:
del
OPTS
[
'
report
'
]
del
OPTS
[
'
report
'
]
attrs
=
[
'
uid
'
,
'
uidNumber
'
,
'
gecos
'
]
attrs
=
[
'
uid
'
,
'
uidNumber
'
,
'
gecos
'
]
attrs
.
extend
([
v
for
k
,
v
in
OPTS
.
items
()
if
args
[
k
]])
attrs
.
extend
([
v
for
k
,
v
in
OPTS
.
items
()
if
args
[
k
]])
for
attr
in
[
v
for
k
,
v
in
NOOPTS
.
items
()
if
args
[
k
]]:
if
attr
in
attrs
:
attrs
.
remove
(
attr
)
users
=
dphysldap
.
Users
(
ldap
,
attrs
)
users
=
dphysldap
.
Users
(
ldap
,
attrs
)
users
.
search
(
'
;
'
.
join
(
members
))
users
.
search
(
'
;
'
.
join
(
members
))
users
.
sort
(
'
uid
'
)
users
.
sort
(
'
uid
'
)
print
(
'
Members:
'
)
if
args
[
'
uid_only
'
]:
print
(
users
)
for
user
in
users
:
print
(
user
[
'
uid
'
])
elif
args
[
'
name_only
'
]:
for
user
in
users
:
print
(
user
[
'
gecos
'
])
else
:
print
(
'
Members:
'
)
print
(
users
)
else
:
else
:
print
(
'
Members: none
'
)
print
(
'
Members: none
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment