本文整理汇总了Python中placard.client.LDAPClient.update_user方法的典型用法代码示例。如果您正苦于以下问题:Python LDAPClient.update_user方法的具体用法?Python LDAPClient.update_user怎么用?Python LDAPClient.update_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类placard.client.LDAPClient
的用法示例。
在下文中一共展示了LDAPClient.update_user方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_account
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def create_account(self, person, default_project):
ua = super(AccountDataStore, self).create_account(person, default_project)
conn = LDAPClient()
ldap_attrs = __import__(settings.LDAP_ATTRS, {}, {}, [''])
data = conn.get_user('sAMAccountName=%s' % person.username).__dict__
data['cluster_account'] = True
data['objectClass'] = settings.ACCOUNT_OBJECTCLASS
data['default_project'] = default_project
data['person'] = person
conn.update_user(
'sAMAccountName=%s' % person.username,
objectClass=settings.ACCOUNT_OBJECTCLASS,
uidNumber=ldap_attrs.GENERATED_USER_ATTRS['uidNumber'](data),
gidNumber=ldap_attrs.GENERATED_USER_ATTRS['gidNumber'](data),
unixHomeDirectory=ldap_attrs.GENERATED_USER_ATTRS['unixHomeDirectory'](data),
loginShell=ldap_attrs.GENERATED_USER_ATTRS['loginShell'](data),
uid=person.username,
msSFU30Name=person.username,
msSFU30NisDomain=settings.LDAP_NISDOMAIN,
unixUserPassword='ABCD!efgh12345$67890',
)
del(conn)
return ua
示例2: unlock_user
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def unlock_user(self, person):
super(PersonalDataStore, self).unlock_user(person)
conn = LDAPClient()
conn.update_user(
'sAMAccountName=%s' % person.username,
userAccountControl=512,
)
示例3: lock_user
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def lock_user(self, person):
super(PersonalDataStore, self).lock_user(person)
conn = LDAPClient()
conn.update_user(
'uid=%s' % person.username,
nsRoleDN=settings.LDAP_LOCK_DN,
)
del(conn)
示例4: delete_account
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def delete_account(self, ua):
super(AccountDataStore, self).delete_account(ua)
conn = LDAPClient()
conn.update_user(
'uid=%s' % ua.username,
gecos='',
uidNumber='',
gidNumber='',
homeDirectory='',
loginShell='',
objectClass=settings.USER_OBJECTCLASS
)
del(conn)
示例5: update_user
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def update_user(self, person):
conn = LDAPClient()
conn.update_user(
'sAMAccountName=%s' % person.username,
cn='%s %s' % (str(person.first_name), str(person.last_name)),
givenName=str(person.first_name),
sn=str(person.last_name),
telephoneNumber=str(person.telephone),
mail=str(person.email),
o=str(person.institute.name),
)
del(conn)
super(PersonalDataStore, self).update_user(person)
示例6: delete_account
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def delete_account(self, ua):
super(AccountDataStore, self).delete_account(ua)
conn = LDAPClient()
conn.update_user(
'sAMAccountName=%s' % ua.username,
uidNumber='',
gidNumber='',
unixHomeDirectory='',
loginShell='',
msSFU30Name='',
msSFU30NisDomain='',
unixUserPassword='',
objectClass=settings.USER_OBJECTCLASS
)
示例7: update_account
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def update_account(self, ua):
super(AccountDataStore, self).update_account(ua)
conn = LDAPClient()
ldap_attrs = __import__(settings.LDAP_ATTRS, {}, {}, [''])
data = conn.get_user('uid=%s' % ua.username).__dict__
data['default_project'] = ua.default_project
data['person'] = ua.user
conn.update_user(
'uid=%s' % ua.username,
homeDirectory=ldap_attrs.GENERATED_USER_ATTRS['homeDirectory'](data),
gecos=ldap_attrs.GENERATED_USER_ATTRS['gecos'](data),
gidNumber=ldap_attrs.GENERATED_USER_ATTRS['gidNumber'](data),
)
del(conn)
示例8: create_account
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def create_account(self, person, default_project):
ua = super(AccountDataStore, self).create_account(person, default_project)
conn = LDAPClient()
ldap_attrs = __import__(settings.LDAP_ATTRS, {}, {}, [''])
data = conn.get_user('uid=%s' % person.username).__dict__
data['objectClass'] = settings.ACCOUNT_OBJECTCLASS
data['default_project'] = default_project
data['person'] = person
conn.update_user(
'uid=%s' % person.username,
gecos=ldap_attrs.GENERATED_USER_ATTRS['gecos'](data),
uidNumber=ldap_attrs.GENERATED_USER_ATTRS['uidNumber'](data),
gidNumber=ldap_attrs.GENERATED_USER_ATTRS['gidNumber'](data),
homeDirectory=ldap_attrs.GENERATED_USER_ATTRS['homeDirectory'](data),
loginShell=ldap_attrs.GENERATED_USER_ATTRS['loginShell'](data),
objectClass=settings.ACCOUNT_OBJECTCLASS
)
del(conn)
return ua
示例9: activate_user
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def activate_user(self, person):
person = super(PersonalDataStore, self).activate_user(person)
attrs = {}
attrs['sAMAccountName'] = str(person.username)
attrs['givenName'] = str(person.first_name)
attrs['sn'] = str(person.last_name)
attrs['telephoneNumber'] = str(person.telephone)
attrs['mail'] = str(person.email)
attrs['o'] = str(person.institute.name)
conn = LDAPClient()
dn = conn.add_user(**attrs)
person.save(update_datastore=False)
# Set password then unlock account
if person.user.password != '!':
import ldap
mod_attrs = [(ldap.MOD_REPLACE, 'unicodePwd', str(person.user.password)), (ldap.MOD_REPLACE, 'unicodePwd', str(person.user.password))]
conn.conn.modify_s(dn, mod_attrs)
conn.update_user('sAMAccountName=%s' % str(person.username), userAccountControl=512)
person.user.set_unusable_password()
person.user.save()
del(conn)
return person
示例10: change_shell
# 需要导入模块: from placard.client import LDAPClient [as 别名]
# 或者: from placard.client.LDAPClient import update_user [as 别名]
def change_shell(self, ua, shell):
super(AccountDataStore, self).change_shell(ua, shell)
conn = LDAPClient()
conn.update_user('uid=%s' % ua.username, loginShell=str(shell))
del(conn)