GithubHelp home page GithubHelp logo

plow's Introduction

What is PLOW?

PLOW stands for python-ldap object wrapper. As the name implies, it provides an object wrapper around the python-ldap lib for simpler usage.

Features:

  • Results paging
  • Attribute ranges handled for large attribute lists
  • Automatic reconnection
  • Atomic changes (deletes old value explicitely)
  • Smarter modlist generation than ldap.modlist.modifyModlist. Much more efficient when updating group membership or other attributes that could have large number of values.

Build Status

Example Usage

from plow.ldapadaptor import LdapAdaptor
from plow.ldapclass import LdapType

srv = LdapAdaptor(
    'ldaps://localhost',
     base_dn='dc=example,dc=com',
     bind_user='cn=manager,dc=example,dc=com',
     bind_password='password',
     )

User = LdapType.from_config("User",  {
        "rdn" : "uid",
        "uid" : "uid",
        "objectClass" : "inetOrgPerson",
        "attributes" : {
            "name" : {
                "attribute" : "givenName",
            }
        }
    })

Group = LdapType.from_config("Group", {
        "rdn" : "cn",
        "uid" : "cn",
        "objectClass" : "posixGroup",
        "attributes" : {
            "members" : {
                "relation" : "member",
                "attribute" : "memberUid",
                "remote_attribute" : "uid",
            }
        }
    })

OU = LdapType.fromConfig("OU", {
    "rdn" : "ou",
    "objectClass" : "organizationalUnit",
    "structural" : True,
    "attributes" : {},
})

user = User.get(uid='veloutin', la=srv)
print "What's my name?", user.name
group = Group.get(uid='employees', la=srv)

if user not in group.members:
    group.members.add(user)
    group.save()

base = OU.get("ou=People", la=srv, addbase=True)
print user in base

plow's People

Contributors

veloutin avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

simpoir

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.