Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allowing edit program to change the group

listing group in list program
  • Loading branch information...
commit 8eee8da59893eae8d2e649016f6575e9a86fa5a9 1 parent ce5d9fe
BuzzTroll authored
View
18 home/libexec/nimbus_edit_user.py
@@ -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)
@@ -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:
View
8 home/libexec/nimbus_list_users.py
@@ -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):
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.