Skip to main content

CSH LDAP ORM

Project description

csh-ldap

PyPI version Build Status

Python 3 ORM for CSH LDAP

Installation

pip install csh-ldap

Usage

import csh_ldap

# Create an unbatched instance
instance = csh_ldap.CSHLDAP(bind_dn, bind_pw)

# Create an batched instance
instance_batched = csh_ldap.CSHLDAP(bind_dn, bind_pw, batch_mods=True)

# Create a Read-Only instance that will only echo your changes
instance_ro = csh_ldap.CSHLDAP(bind_dn, bind_pw, ro=True)

# Get member by UUID
liam = instance.get_member(uuid_of_liam)

# Get member by UID
liam = instance.get_member(uid_of_liam, uid=True)

# Get member by iButton ID
liam = instance.get_member_ibutton(ibutton_id)

# Get member by Slack UID
liam = instance.get_member_slackuid(slack_uid)

# Get group by cn
rtp = instance.get_group('rtp')

# get group member uids 
rtp = instance.get_group('rtp').get_member_uids()
# returns ['spaced', ...]

# get group member uids (other way)
rtp = instance.get_group_member_uids(groups=["rtp"])

# get uids of members in two (or more) groups and not in groups
fancy = instance.get_group_member_uids(groups=["rtp", "onfloor"], excluded=["eboard-opcomm"])

# get uuids of members in two (or more) groups and not in groups
# that's right! ipaUniqueId
fancy = instance.get_group_member_uuids(groups=["rtp", "onfloor"], excluded=["eboard-opcomm"])

# get other miscellaneous attributes of members in group
# look how rich drink admins are (admin abuse!!!)
admin_abuse = instance.get_group_member_attributes(group=["drink"], attributes=["uid", "drinkBalance"])
# returns dicts for each member
"""
I wonder what happened here
[
{
    'uid': 'cole',
    'drinkBalance': '996246'
},
{
    'uid': 'zxcv',
    'drinkBalance': '3847173'
}
]
"""

# Get cn of member
print(liam.cn)

# Set cn of member
liam.cn = "Liam Middlebrook"

# Setting attributes to None removes them
liam.roomNumber = None

# Process batched writes per-dn
instance_batched.flush_mod()

# Get EBoard Directorship
# Directorships: ['chairman', 'evaluations', 'financial', 'history', 'imps', 'opcomm', 'research', 'social']
social = instance.get_directorship_heads('social')

for director in social:
    # Directorships are always lists, since it can be multiple people.
    print(director.cn)

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

csh_ldap-2.5.7.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csh_ldap-2.5.7-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file csh_ldap-2.5.7.tar.gz.

File metadata

  • Download URL: csh_ldap-2.5.7.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for csh_ldap-2.5.7.tar.gz
Algorithm Hash digest
SHA256 7a11a8a1bd43812e7f4cc42da7c74d0ca07a2f57fb14d190954e0783f21aeb50
MD5 5aff7bb46a6338305a188e96e4562fd1
BLAKE2b-256 608f6c29de8fb66291377540f50cf1fecfffbae27d4d35ecd52c5a4bfda4d89a

See more details on using hashes here.

Provenance

The following attestation bundles were made for csh_ldap-2.5.7.tar.gz:

Publisher: pypi-release.yaml on ComputerScienceHouse/csh-ldap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csh_ldap-2.5.7-py3-none-any.whl.

File metadata

  • Download URL: csh_ldap-2.5.7-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for csh_ldap-2.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d43768c24dcf4e8db7374fff5aabe280f0ca15740b8e9e5cdd8df2f996fab880
MD5 9c2a4cc29c418be0ab18b6e4e1876905
BLAKE2b-256 285504b692813a76343b6e4a5dd0d3dd0d10894c87ef0073db8013f3717a84c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for csh_ldap-2.5.7-py3-none-any.whl:

Publisher: pypi-release.yaml on ComputerScienceHouse/csh-ldap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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