def _sidConversion(cls, val, **kwargs):
        '''
        converts a list of pysid objects to string representations
        '''
        if isinstance(val, six.string_types):
            val = val.split(',')
        usernames = []
        for _sid in val:
            try:
                userSid = win32security.LookupAccountSid('', _sid)
                if userSid[1]:
                    userSid = '{1}\\{0}'.format(userSid[0], userSid[1])
                else:
                    userSid = '{0}'.format(userSid[0])
            # TODO: This needs to be more specific
            except Exception:
                userSid = win32security.ConvertSidToStringSid(_sid)
                log.warning('Unable to convert SID "%s" to a friendly name.  The SID will be disaplayed instead of a user/group name.', userSid)
            usernames.append(userSid)
        return usernames
def _sidConversion ( cls , val , ** kwargs ) : if isinstance ( val , six . string_types ) : val = val . split ( ',' ) usernames = [ ] for _sid in val : try : userSid = win32security . LookupAccountSid ( '' , _sid ) if userSid [ 1 ] : userSid = '{1}\\{0}' . format ( userSid [ 0 ] , userSid [ 1 ] ) else : userSid = '{0}' . format ( userSid [ 0 ] ) except Exception : userSid = win32security . ConvertSidToStringSid ( _sid ) log . warning ( 'Unable to convert SID "%s" to a friendly name.  The SID will be disaplayed instead of a user/group name.' , userSid ) usernames . append ( userSid ) return usernames
converts a list of pysid objects to string representations