End point to get common user uri by lti user id
@throws \common_exception_NotImplemented
175342
public function getUserId()
    {
        try {
            $parameters = $this->getParameters();
            if (!isset($parameters[self::LTI_USER_ID])) {
                throw new \common_exception_MissingParameter(self::LTI_USER_ID, __FUNCTION__);
            }
            if (!isset($parameters[self::LTI_CONSUMER_KEY])) {
                throw new \common_exception_MissingParameter(self::LTI_CONSUMER_KEY, __FUNCTION__);
            }

            $id = $parameters[self::LTI_USER_ID];
            $key = $parameters[self::LTI_CONSUMER_KEY];

            $data = $this->getCrudService->getUserId($id, $key);
            if (!$data) {
                \common_Logger::i('Id ' . $id . ' is not found.');
                throw new \common_exception_NotFound('No data found for the given id.');
            }

            $this->returnSuccess($data);
        } catch (\Exception $e) {
            \common_Logger::w($e->getMessage());
            $this->returnFailure($e);
        }
    }
55416
protected function currentUrlUri()
    {
        if (isset(static::$static[__FUNCTION__])) {
            return static::$static[__FUNCTION__];
        }
        if (!empty($this->options['current_url_uri'])) {
            return static::$static[__FUNCTION__] = $this->mustParseUri($this->options['current_url_uri']);
        }
        if (empty($_SERVER['REQUEST_URI'])) {
            throw new \Exception('Missing required `$_SERVER[\'REQUEST_URI\']`.');
        }
        return static::$static[__FUNCTION__] = $this->mustParseUri($_SERVER['REQUEST_URI']);
    }
1105744
private function fetchUserId()
  {
    $pool = Registry::getStash();

    $cache = $pool->getItem('nyaa/user/'.$this->getTorrentId());

    if ($cache->isMiss()) {
      // sadly we have to use the site since nothing provides the user id
      $userId = false;
      $html = file_get_contents($this->siteUrl);

      // lets not depend on the actual domain
      if(preg_match('~\/\?user\=([0-9]+)~i', $html, $match)) {
        $userId = intval($match[1]);
      }

      $cache->set($userId);
    }

    return $cache->get();
  }
523308
public function getUri()
	{
		if(!empty($this->data['uri'])){
			$uri =  $this->data['uri'];
		} elseif(!empty($this->data['base'])) {
			$idGenerator=$this->uniqueIdGenerator;
			$uri = $this->data['base'];
			$uri.=empty($this->data['id'])?$idGenerator($this->data):$this->data['id'];
		} else{
			$idGenerator=$this->uniqueIdGenerator;
			$uri = 'urn:local:botk:'.$idGenerator($this->data);
		}
		
		return $uri;
	}
382945
public function getUser()
    {
        if ( null === $this->_user && $this->userId )
        {
            $this->_user = $this->getUserMapper()
                                ->find( $this->userId );
        }

        return $this->_user;
    }
1310057
private function getUserUuid() {
        if ($this->uuid === null) {

            $path = $this->getRequest()->getUri()->getPath();
            $uuid = substr($path, strrpos($path, '/')+1);
            if (strlen($uuid) === 32 && preg_match('/[a-z0-9]/', $uuid)) {
                $this->uuid = $uuid;
            }
            else {
                throw new \InvalidArgumentException('The uuid cannot be empty.');
            }
        }
        return $this->uuid;
    }
447854
def _get_lt_from_user_by_id(self, user, lt_id):
        
        req = meta.Session.query(LayerTemplate).select_from(join(LayerTemplate, User))
        try:
            return req.filter(and_(User.login==user, LayerTemplate.id==lt_id)).one()
        except Exception, e:
            return None
1021258
public function resolveRelativeUri(string $uri): string
    {
        $parts = parse_url($uri);
        if (isset($parts['scheme'])) {
            // absolute URL
            return $uri;
        }

        $baseUri = $this->getUri();
        if (strncmp($baseUri, 'file://', 7) === 0) {
            if (isset($parts['path'][0]) && $parts['path'][0] === '/') {
                // absolute path
                return 'file://' . $parts['path'];
            }
            if (isset($parts['path'])) {
                // relative path
                return dirname($baseUri) . '/' . $parts['path'];
            }

            throw new UnresolvableReferenceException("Invalid URI: '$uri'");
        }

        $baseParts = parse_url($baseUri);
        $absoluteUri = implode('', [
            $baseParts['scheme'],
            '://',
            isset($baseParts['username']) ? $baseParts['username'] . (
                isset($baseParts['password']) ? ':' . $baseParts['password'] : ''
            ) . '@' : '',
            $baseParts['host'] ?? '',
            isset($baseParts['port']) ? ':' . $baseParts['port'] : '',
        ]);
        if (isset($parts['path'][0]) && $parts['path'][0] === '/') {
            $absoluteUri .= $parts['path'];
        } elseif (isset($parts['path'])) {
            $absoluteUri .= rtrim(dirname($baseParts['path'] ?? ''), '/') . '/' . $parts['path'];
        }
        return $absoluteUri
            . (isset($parts['query']) ? '?' . $parts['query'] : '')
            . (isset($parts['fragment']) ? '#' . $parts['fragment'] : '');
    }
1167129
public function getEmbedRestrictionId(): \Psr\Http\Message\UriInterface
    {
        if (!$this->embedRestrictionId) {
            return new Uri();
        }

        return $this->embedRestrictionId;
    }
625068
private function getRecomUser($each_recom)
    {
        $user = $each_recom->find('.users', 0)->plaintext;
        $user = str_replace(['Users', 'User'], '', $user);

        return trim($user);
    }
226406
public function update($uri = null, $propertiesValues = array())
    {
        if (is_null($uri)) {
            throw new \common_exception_MissingParameter("uri");
        }
        if (isset($propertiesValues[GenerisRdf::PROPERTY_USER_LOGIN])) {
            throw new \common_exception_PreConditionFailure("login update not allowed");
        }
        if (isset($propertiesValues[GenerisRdf::PROPERTY_USER_PASSWORD])) {
            $propertiesValues[GenerisRdf::PROPERTY_USER_PASSWORD] = \core_kernel_users_Service::getPasswordHash()->encrypt($propertiesValues[GenerisRdf::PROPERTY_USER_PASSWORD]);
        }
        parent::update($uri, $propertiesValues);
        // throw new common_exception_NotImplemented();
    }
268443
public function queryUser($groupId) {
    	try{
			if (empty($groupId))
				throw new Exception('Paramer "groupId" is required');


    		$params = array (
    		'groupId' => $groupId
    		);

    		$ret = $this->SendRequest->curl('/group/user/query.json',$params,'urlencoded','im','POST');
    		if(empty($ret))
    			throw new Exception('bad request');
    		return $ret;

    	}catch (Exception $e) {
    		print_r($e->getMessage());
    	}
   }
1219899
public function getCurrentUser()
    {
        $returnValue = null;

    	if(!common_session_SessionManager::isAnonymous()){
        	$userUri = \common_session_SessionManager::getSession()->getUser()->getIdentifier();
			if(!empty($userUri)){
        		$returnValue = new core_kernel_classes_Resource($userUri);
			} else {
				common_Logger::d('no userUri');
			}
    	}

        return $returnValue;
    }
382610
public function getExcludeUserIds()
    {
        $userIds = array();
        $currentGroupId = -1;
        //First of all we need to test if subject is group or user
        //In case of group we need to exclude all these users that already exist in role
        if ($this->receiverGroup !== null) {
            $currentGroupId = $this->receiverGroup->getId();
            $roleUsers = $this->role->getUsers();
            foreach ($roleUsers as $user) {
                array_push($userIds, $user->getId());
            }
        }

        //For both cases (user or group) we need to exclude all users already enrolled in other groups
        $roleGroups = $this->role->getGroups();

        if ($roleGroups) {
            foreach ($roleGroups as $group) {
                if ($group->getId() != $currentGroupId) {
                    $userIds = array_merge($userIds, $group->getUserIds());
                }
            }
        }
        $userIds = array_unique($userIds);

        return $userIds;
    }
219719
protected static function _getUserId()
    {
        if (is_null(self::$_userID)) {
            self::$_userID = null;
            if (isset(Yii::$app->user) and !empty(Yii::$app->user->id)) {
                self::$_userID = Yii::$app->user->id;
            }
        }

        return self::$_userID;
    }
75846
public function getUserId() {

		if (!$this->authSource->isAuthenticated()) {
			return NULL;
		}

		$attributes = $this->authSource->getAttributes();
		if (!array_key_exists($this->usernameAttribute, $attributes)) {
			throw new SimpleSAML_Error_Exception('Missing username attribute ' .
				var_export($this->usernameAttribute, TRUE) . ' in the attributes of the user.');
		}

		$values = array_values($attributes[$this->usernameAttribute]);
		if (empty($values)) {
			throw new SimpleSAML_Error_Exception('Username attribute was empty.');
		}
		if (count($values) > 1) {
			throw new SimpleSAML_Error_Exception('More than one attribute value in username.');
		}

		$userId = $values[0];
		return $userId;
	}
703172
protected function getRoutes()
    {
        $route = $this->getRequestParameter('route');
        if (empty($route)) {
            throw new \common_exception_MissingParameter('You must specify a route');
        }

        if (!is_array($route)) {
            $route = [$route];
        }

        return $route;
    }