<s> from ldaptor . protocols . ldap . autofill import ObjectMissingObjectClassException <EOL> class Autofill_samba : <EOL> def __init__ ( self , domainSID , fixedPrimaryGroupSID = None ) : <EOL> self . domainSID = domainSID <EOL> self . fixedPrimaryGroupSID = fixedPrimaryGroupSID <EOL> def start ( self , ldapObject ) : <EOL> assert '<STR_LIT>' in ldapObject <EOL> if '<STR_LIT>' not in ldapObject [ '<STR_LIT>' ] : <EOL> raise ObjectMissingObjectClassException , ldapObject <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT:1>' ] <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT:0>' ] <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT:0>' ] <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT:0>' ] <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT:0>' ] <EOL> if self . fixedPrimaryGroupSID is not None : <EOL> assert '<STR_LIT>' not in ldapObject <EOL> ldapObject [ '<STR_LIT>' ] = [ '<STR_LIT>' % ( <EOL> self . domainSID , self . fixedPrimaryGroupSID ) ] <EOL> for attributeType in ldapObject . keys ( ) : <EOL> self . notify ( ldapObject , attributeType ) <EOL> def notify ( self , ldapObject , attributeType ) : <EOL> if attributeType == '<STR_LIT>' : <EOL> assert '<STR_LIT>' in ldapObject <EOL> assert len ( ldapObject [ '<STR_LIT>' ] ) == <NUM_LIT:1> <EOL> for uidNumber in ldapObject [ '<STR_LIT>' ] : <EOL> uidNumber = int ( uidNumber ) <EOL> sid = '<STR_LIT>' % ( self . domainSID , uidNumber * <NUM_LIT:2> + <NUM_LIT:1000> ) <EOL> ldapObject [ '<STR_LIT>' ] = [ str ( sid ) ] <EOL> return <EOL> if ( self . fixedPrimaryGroupSID is None <EOL> and attributeType == '<STR_LIT>' ) : <EOL> assert '<STR_LIT>' in ldapObject <EOL> assert len ( ldapObject [ '<STR_LIT>' ] ) == <NUM_LIT:1> <EOL> for gidNumber in ldapObject [ '<STR_LIT>' ] : <EOL> gidNumber = int ( gidNumber ) <EOL> sid = '<STR_LIT>' % ( self . domainSID , gidNumber * <NUM_LIT:2> + <NUM_LIT> ) <EOL> ldapObject [ '<STR_LIT>' ] = [ str ( sid ) ] <EOL> return </s>
