def get_gid_byname(self, group):
"""Get gid for given group name.
Raise RBFatalError if given name does not belong to a group in
group database."""
res = self.ldap.search_s(rbconfig.ldap_group_tree, ldap.SCOPE_ONELEVEL,
'cn=%s' % group)
if res:
return int(res[0][1]['gidNumber'][0])
else:
raise RBFatalError("Group '%s' does not exist" % group)
评论列表
文章目录