Skip to main content

Manage users, groups and services of the ETH Identity and Access Management system (IAM)

Project description

ETHZ IAM Webservice

Manage users, groups and services of the ETH Identity and Access Management system (IAM)

Command Line Interface

When installing this module, the iam command is also installed. The basic parameters which are always needed – otherwise they will be asked interactivley – are:

$ iam -u admin-username --password MY-SECRET-PASSWORD

You can also set these environment variables instead:

$ export IAM_USERNAME=admin-username
$ export IAM_PASSWORD=MY-SECRET-PASSWORD

Group

$ iam group <group-name> -i / --info
$ iam group <group-name> -m / --members
$ iam group <group-name> -d / --delete 

$ iam group <group-name> -a user1 --add user2
$ iam group <group-name> -r user3 --remove user4

User

$ iam user username -i
$ iam user username --grant-service LDAPS, -g Mailbox
$ iam user username --revoke-service LDAPS, -r Mailbox
$ iam user username --set-password [-s LDAPS [-s Mailbox]]
$ iam user username --service-password XYZ [-s LDAPS [-s Mailbox]]

Person

You might either provide a username, a NPID or a email address.

$ iam person username -i
$ iam person swen@ethz.ch -i
$ iam person 123445 -i

Synopsis

Login

import ethz_iam_webservice
import getpass

e = ethz_iam_webservice.login('admin4iam', getpass.getpass())

Person

person = e.get_person('name@example.com')
person = e.get_person('some_username')
person = e.get_person(123456)             # npid (internal Person identifier)

person.usernames                          # an array of dicts of usernames
person.data                               # raw webservice response
person.firstname
person.familyname
person.email
# etc.

User

user = person.new_user('username', 'password', 'description')
user = e.get_user('username')
user.services                             # an array of dicts of services

user.grant_service("LDAPS")
user.grant_service("Active Directory")
user.grant_service("WLAN_VPN")

user.revoke_service("LDAPS")

user.delete() 
user.add_to_group('groupname')
user.remove_from_group('groupname')

Group and Group Members

get single group - returns a Group object or throws a ValueError if group is not found

group = e.new_group(
    name        = 'group-name',
    description = 'something meaningful',
    admingroup  = 'ID SIS',              # responsible admin group
    targets     = ['AD', 'LDAPS'],       # please specify at least one target system
    members     = ['user1', 'user2']
)

group = e.get_group('groupname')
group = e.get_group(123456)              # gidNumber
group.data                               # all data received from webservice
group.members                            # returns array of usernames or group-names
group.gidNumber
group.<attribute>

add/remove group members

group.add_members('some', 'new', 'members')
group.set_members('just', 'these')
group.del_members('remove', 'these', 'members')

search for groups - Result is always a list of groups or an empty list

groups = e.get_groups(agroup='ID SIS')
groups = e.get_groups(name='starts_with*')
groups = e.get_groups(agroup='ID SIS', name='starts_with*')

Mailinglists

ml = e.get_mailinglist('ID.SIS.SSDM')
ml = e.get_mailinglist('sis@id.ethz.ch')
ml.name
ml.mail
ml.gidNumber
ml.groupType
ml.displayName
...

ml.members        # returns all (direct) members of that list
ml.add_members('user1', 'user2')
ml.del_members('user3, 'user4')

See also FAQ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ethz_iam_webservice-0.3.1.tar.gz (7.9 kB view details)

Uploaded Source

File details

Details for the file ethz_iam_webservice-0.3.1.tar.gz.

File metadata

  • Download URL: ethz_iam_webservice-0.3.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.0

File hashes

Hashes for ethz_iam_webservice-0.3.1.tar.gz
Algorithm Hash digest
SHA256 49eda40ef28cb20495c804f6bf214b6d2f47d35a594b62bf59ae90cf59a897f6
MD5 ed993cb7cbd6f6d183b390fd1ffb23a9
BLAKE2b-256 0f3072d797f3babb4cccf21fb3b4195c55fc29e229a7b18fde426967da8ca20a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page