Returns the UID for the username on the host.
503164
def get_uid(username)
      Etc.passwd { |u| return u.uid if u.name == username }
    end
725456
def id(self):
        
        h = hashlib.new('sha512')
        for value in (self.machine.name, self.machine.os, self.user, self.application.name,
                      self.application.path, self.event.report_type, self.event.type,
                      self.event.time.isoformat()):
            h.update(str(value).encode('utf-8'))
        for parameter in sorted(self.parameters, key=lambda k: getattr(k, 'id')):
            h.update(parameter.value.encode('utf-8'))
        return h.hexdigest()
322092
def getContactUIDForUser(self):
        
        user = self.REQUEST.AUTHENTICATED_USER
        user_id = user.getUserName()
        r = self.portal_catalog(
            portal_type='Contact',
            getUsername=user_id
        )
        if len(r) == 1:
            return r[0].UID
92043
def usable_id(cls, id):
        
        try:
            # id is maybe a hostname
            qry_id = cls.from_name(id)
            if not qry_id:
                # id is maybe an ip
                qry_id = cls.from_ip(id)
            if not qry_id:
                qry_id = cls.from_vhost(id)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
1347166
def _author_uid_get(post):
    
    u = post.meta('author.uid')
    return u if u else str(current_user.uid)
548727
def get_pub_id_owner(self, pub_id):
        """"""
        con = self.connection or self._connect()
        cur = con.cursor()

        cur.execute(
            """SELECT distinct username from upload.reaction
            WHERE pub_id = '{pub_id}'"""
            .format(pub_id=pub_id))

        username = cur.fetchall()[0][0]

        return username
1185918
private String getUserAccessId(String userName) {

        try {
            SecurityService securityService = securityServiceRef.getService();
            UserRegistryService userRegistryService = securityService.getUserRegistryService();
            UserRegistry userRegistry = userRegistryService.getUserRegistry();
            String realm = userRegistry.getRealm();
            String uniqueId = userRegistry.getUniqueUserId(userName);
            return AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, realm, uniqueId);
        } catch (EntryNotFoundException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Caught exception getting the access id for "
                             + userName + ": " + e);
            }
        } catch (RegistryException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Caught exception getting the access id for "
                             + userName + ": " + e);
            }
        }
        return null;
    }
1363803
def get_user(uid):
    
    if db is not None:
        try:
            uid = uid.decode('utf-8')
        except AttributeError:
            pass
        d = db.hgetall('user:{0}'.format(uid))
        if d:
            nd = {}
            # strings everywhere
            for k in d:
                try:
                    nd[k.decode('utf-8')] = d[k].decode('utf-8')
                except AttributeError:
                    try:
                        nd[k.decode('utf-8')] = d[k]
                    except AttributeError:
                        nd[k] = d[k]
            for p in PERMISSIONS:
                nd[p] = nd.get(p) == '1'
            return User(uid=uid, **nd)
        else:
            return None
    else:
        d = app.config['COIL_USERS'].get(uid)
        if d:
            return User(uid=uid, **d)
        else:
            return None
568832
def find_user_by_name(username):
    
    if db is not None:
        uid = db.hget('users', username)
        if uid:
            return get_user(uid)
    else:
        for uid, u in app.config['COIL_USERS'].items():
            if u['username'] == username:
                return get_user(uid)
755554
def hostname(self):
        """"""
        try:
            return self.data.get('identity').get('host_name')
        except (KeyError, AttributeError):
            return self.device_status_simple('')
717804
def get_name(self):
        """"""
        if self.given_name is None:
            # Name according to host
            if self.hostname is None:
                name = _("Console")
            else:
                name = self.hostname
            # Adding id to name
            client_id = self.id_['int_id'] + u'/' + self.id_['str_id']
            name = name + u' ' + client_id
        elif self.given_name in ["Pylab", "SymPy", "Cython"]:
            client_id = self.id_['int_id'] + u'/' + self.id_['str_id']
            name = self.given_name + u' ' + client_id
        else:
            name = self.given_name + u'/' + self.id_['str_id']
        return name
819121
def getMyID(self,gist_name):
		'''
		
		'''
		r = requests.get(
			'%s'%BASE_URL+'/users/%s/gists' % self.user,
			headers=self.gist.header
			)
		if (r.status_code == 200):
			r_text = json.loads(r.text)
			limit = len(r.json())

			for g,no in zip(r_text, range(0,limit)):
				for ka,va in r.json()[no]['files'].iteritems():
					if str(va['filename']) == str(gist_name):
						return r.json()[no]['id']
			return 0

		raise Exception('Username not found')
214801
def local_id(self):
        
        return hashlib.sha256(("%s%s" % (
            self.id,
            self.username)).encode()).hexdigest()
777121
def get_username(identifier):
    """"""
    pattern = re.compile('.+@\w+\..+')
    if pattern.match(identifier):
        try:
            user = User.objects.get(email=identifier)
        except:
            raise Http404
        else:
            return user.username
    else:
        return identifier
474381
def chuid(name, uid):
    '''
    
    '''
    if not isinstance(uid, int):
        raise SaltInvocationError('uid must be an integer')
    pre_info = info(name)
    if not pre_info:
        raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
    if uid == pre_info['uid']:
        return True
    _dscl(
        ['/Users/{0}'.format(name), 'UniqueID', pre_info['uid'], uid],
        ctype='change'
    )
    # dscl buffers changes, sleep 1 second before checking if new value
    # matches desired value
    time.sleep(1)
    return info(name).get('uid') == uid
414423
def from_hostname(cls, hostname):
        """"""
        result = cls.list({'hostname': str(hostname)})
        if result:
            return result[0]['id']
750384
def get_default_remote_name():
    
    s = u'%s@%s:%d'
    s %= (getpass.getuser(), socket.gethostname(), os.getpid())
    # In mixed UNIX/Windows environments, the username may contain slashes.
    return s.translate({
        ord(u'\\'): ord(u'_'),
        ord(u'/'): ord(u'_')
    })