~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to scripts/usrmgt-server

  • Committer: drtomc
  • Date: 2008-02-14 03:12:22 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:454
usrmgt-server: more work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        username    - used as a unix login name and svn repository name.
32
32
                      STRING REQUIRED 
33
33
        uid         - the unix uid under which execution will take place
34
 
                      on the behalf of the user. Don't use 0!
35
 
                      INT REQUIRED
36
 
        password    - the clear-text password for the user. If None is used
37
 
                      as an indication that external authentication should
38
 
                      be used (i.e. LDAP).
 
34
                      on the behalf of the user. Don't use 0! If not specified
 
35
                      or None, one will be allocated from the configured
 
36
                      numeric range.
 
37
                      INT OPTIONAL
 
38
        password    - the clear-text password for the user. If this property is
 
39
                      absent or None, this is an indication that external
 
40
                      authentication should be used (i.e. LDAP).
39
41
                      STRING OPTIONAL
40
42
        nick        - the display name to use.
41
43
                      STRING REQUIRED
45
47
        rolenm      - The user's role. Must be one of "anyone", "student",
46
48
                      "tutor", "lecturer", "admin".
47
49
                      STRING/ENUM REQUIRED
48
 
        studentid   - If supplied (not None), the student id of the user for
 
50
        studentid   - If supplied and not None, the student id of the user for
49
51
                      results and/or other official purposes.
50
52
                      STRING OPTIONAL
 
53
       Return Value: the uid associated with the user. INT
51
54
    """
52
55
 
53
56
    if 'uid' not in props:
54
 
        uid = invent-uid
55
 
        props['uid'] = uid
 
57
        raise Exception, "No algorithm for creating uids yet!"
 
58
        # uid = invent-uid
 
59
        # props['uid'] = uid
56
60
 
57
61
    common.makeuser.make_user_db(props['username'], props['uid'],
58
62
                                 props['password'], props['nick'],
59
63
                                 props['fullname'], props['rolenm'],
60
64
                                 props['studentid'])
61
65
 
 
66
    return props['uid']
 
67
 
 
68
def create_jail(props):
 
69
    """Create the jail for a user.
 
70
       Expected properties:
 
71
        username    - the username for the jail
 
72
                      STRING REQUIRED
 
73
        uid         - the unix uid to make the owner of the home directory
 
74
                      in the jail.
 
75
                      INT REQUIRED
 
76
        gid         - the unix group id to make the group of the home directory
 
77
                      in the jail. If not supplied (or None), then the uid is
 
78
                      also used.
 
79
                      INT OPTIONAL
 
80
    """
62
81
    common.makeuser.make_jail(props['username'], props['uid'])
63
 
 
64
 
    # eventually, we're going to want to grant shell access, in which
65
 
    # case we'll need to add the uid to the password file. Magic to do
66
 
    # that should go here.
67
 
 
68
 
    return props['uid']
 
82
    return None
69
83
 
70
84
actions = {
71
 
        'create-user':create_user
 
85
        'create-user':create_user,
 
86
        'create-jail':create_jail
72
87
    }
73
88
 
74
89
def dispatch(props):