text
stringlengths 0
828
|
|---|
Arguments:
|
val -- the iButton ID of the member
|
Returns:
|
None if the iButton supplied does not correspond to a CSH Member
|
""""""
|
members = self.__con__.search_s(
|
CSHMember.__ldap_user_ou__,
|
ldap.SCOPE_SUBTREE,
|
""(ibutton=%s)"" % val,
|
['ipaUniqueID'])
|
if members:
|
return CSHMember(
|
self,
|
members[0][1]['ipaUniqueID'][0].decode('utf-8'),
|
False)
|
return None"
|
1067,"def get_member_slackuid(self, slack):
|
""""""Get a CSHMember object.
|
Arguments:
|
slack -- the Slack UID of the member
|
Returns:
|
None if the Slack UID provided does not correspond to a CSH Member
|
""""""
|
members = self.__con__.search_s(
|
CSHMember.__ldap_user_ou__,
|
ldap.SCOPE_SUBTREE,
|
""(slackuid=%s)"" % slack,
|
['ipaUniqueID'])
|
if members:
|
return CSHMember(
|
self,
|
members[0][1]['ipaUniqueID'][0].decode('utf-8'),
|
False)
|
return None"
|
1068,"def get_directorship_heads(self, val):
|
""""""Get the head of a directorship
|
Arguments:
|
val -- the cn of the directorship
|
""""""
|
__ldap_group_ou__ = ""cn=groups,cn=accounts,dc=csh,dc=rit,dc=edu""
|
res = self.__con__.search_s(
|
__ldap_group_ou__,
|
ldap.SCOPE_SUBTREE,
|
""(cn=eboard-%s)"" % val,
|
['member'])
|
ret = []
|
for member in res[0][1]['member']:
|
try:
|
ret.append(member.decode('utf-8'))
|
except UnicodeDecodeError:
|
ret.append(member)
|
except KeyError:
|
continue
|
return [CSHMember(self,
|
dn.split('=')[1].split(',')[0],
|
True)
|
for dn in ret]"
|
1069,"def enqueue_mod(self, dn, mod):
|
""""""Enqueue a LDAP modification.
|
Arguments:
|
dn -- the distinguished name of the object to modify
|
mod -- an ldap modfication entry to enqueue
|
""""""
|
# mark for update
|
if dn not in self.__pending_mod_dn__:
|
self.__pending_mod_dn__.append(dn)
|
self.__mod_queue__[dn] = []
|
self.__mod_queue__[dn].append(mod)"
|
1070,"def flush_mod(self):
|
""""""Flush all pending LDAP modifications.""""""
|
for dn in self.__pending_mod_dn__:
|
try:
|
if self.__ro__:
|
for mod in self.__mod_queue__[dn]:
|
if mod[0] == ldap.MOD_DELETE:
|
mod_str = ""DELETE""
|
elif mod[0] == ldap.MOD_ADD:
|
mod_str = ""ADD""
|
else:
|
mod_str = ""REPLACE""
|
print(""{} VALUE {} = {} FOR {}"".format(mod_str,
|
mod[1],
|
mod[2],
|
dn))
|
else:
|
self.__con__.modify_s(dn, self.__mod_queue__[dn])
|
except ldap.TYPE_OR_VALUE_EXISTS:
|
print(""Error! Conflicting Batch Modification: %s""
|
% str(self.__mod_queue__[dn]))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.