def check_group_byid(self, gid):
"""Raise RBFatalError if given id does not belong to a group in
group database."""
if not self.ldap.search_s(rbconfig.ldap_group_tree,
ldap.SCOPE_ONELEVEL, 'gidNumber=%s' % gid):
raise RBFatalError("Group with id '%s' does not exist" % gid)
# ------------------------------------------------------------------- #
# INFORMATION RETRIEVAL METHODS #
# ------------------------------------------------------------------- #
# fixme still needed ?
# def get_usertype_byname(self, uid):
# """Return usertype for username in user database. Raise
# RBFatalError if user does not exist."""
# res = self.ldap.search_s(rbconfig.ldap_accounts_tree,
# ldap.SCOPE_ONELEVEL, 'uid=%s' % usr.uid,
# ('objectClass', ))
# if res:
# for i in res[0][1]['objectClass']:
# if i in rbconfig.usertypes:
# return i
# else:
# raise RBFatalError("Unknown usertype for user '%s'" % uid)
# else:
# raise RBFatalError("User '%s' does not exist" % uid)
评论列表
文章目录