Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
allowing edit program to change the group
Browse files Browse the repository at this point in the history
listing group in list program
  • Loading branch information
BuzzTroll committed Jul 13, 2010
1 parent ce5d9fe commit 8eee8da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
18 changes: 15 additions & 3 deletions home/libexec/nimbus_edit_user.py
Expand Up @@ -70,6 +70,9 @@ def setup_options(argv):
all_opts.append(opt)
opt = cbOpts("delim", "D", "Character between columns in the report", ",")
all_opts.append(opt)
opt = cbOpts("group", "g", "Change the users group", None, vals=(None, "01", "02", "03", "04"))
all_opts.append(opt)

opt = cbOpts("report", "r", "Report the selected columns from the following: " + pycb.tools.report_options_to_string(g_report_options), pycb.tools.report_options_to_string(g_report_options))
all_opts.append(opt)

Expand Down Expand Up @@ -176,14 +179,23 @@ def edit_user(o, db):
if s3u == None:
raise CLIError('EUSER', "There is no s3 user for: %s" % (o.emailaddr))
s3u.set_data(o.access_secret.strip())
if o.dn != None:

nh = get_nimbus_home()
groupauthz_dir = os.path.join(nh, "services/etc/nimbus/workspace-service/group-authz/")
if o.group != None:
if dnu == None:
raise CLIError('EUSER', "There is x509 entry for: %s" % (o.emailaddr))
dn = dnu.get_name()
group = find_member(groupauthz_dir, dn)
if group != None:
remove_member(groupauthz_dir, dn)
add_member(groupauthz_dir, dn, int(o.group))

if o.dn != None:
if dnu == None:
raise CLIError('EUSER', "There is x509 entry for: %s" % (o.emailaddr))
old_dn = dnu.get_name()

nh = get_nimbus_home()
groupauthz_dir = os.path.join(nh, "services/etc/nimbus/workspace-service/group-authz/")

group = find_member(groupauthz_dir, old_dn)
if group == None:
Expand Down
8 changes: 7 additions & 1 deletion home/libexec/nimbus_list_users.py
Expand Up @@ -22,9 +22,10 @@
import logging
import shlex
from nimbusweb.setup.setuperrors import *
from nimbusweb.setup.groupauthz import *

g_created_cert_files=False
g_report_options = ["dn", "canonical_id", "access_id", "access_secret", "display_name"]
g_report_options = ["dn", "canonical_id", "access_id", "access_secret", "display_name", "group"]

class printer_obj(object):
def __init__(self):
Expand Down Expand Up @@ -74,9 +75,14 @@ def report_results(db, user, opts):

dnu = user.get_alias_by_friendly(o.display_name, pynimbusauthz.alias_type_x509)
if dnu != None:
nh = get_nimbus_home()
groupauthz_dir = os.path.join(nh, "services/etc/nimbus/workspace-service/group-authz/")
o.dn = dnu.get_name()
group = find_member(groupauthz_dir, o.dn)
o.group = group.group_id
else:
o.dn = None
o.group = None
o.canonical_id = user.get_id()

s3u = user.get_alias_by_friendly(o.display_name, pynimbusauthz.alias_type_s3)
Expand Down

0 comments on commit 8eee8da

Please sign in to comment.