Recupera o nível de acesso do usuário para a company do domínio atual.

@param user Usuário para recuperar o nível de acesso.
@return Nível de acesso para a instituição atual.
325786
public int retrieveAccessLevel(User user) {
		if (domain == null) {
			return user.getAccessLevel();
		}
		Criteria criteria = this.dao.newCriteria(CompanyUser.class).add(Restrictions.eq("user", user))
				.add(Restrictions.eq("company", domain.getCompany()));
		CompanyUser companyUser = (CompanyUser) criteria.uniqueResult();
		if (companyUser == null) {
			return user.getAccessLevel();
		}
		return Math.max(user.getAccessLevel(), companyUser.getAccessLevel());
	}
236328
public function getEntry4User(UserInterface $user)
    {
        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.usn = :usn')
            ->setParameter('usn', $user->getBackendId())
            ->getQuery();

        $result = null;
        try {
            $result = $query->getOneOrNullResult();
        } catch (\Exception $e) {

        }

        return $result;
    }
438232
public function getFavouriteAccountsForUser(UserInterface $user)
    {
        $criteria = new Criteria();
        $criteria
            ->where($criteria->expr()->in(
                'id',
                $user->getMyFavouriteAccountIds()
            ))
        ;

        return $this->oh->getOrganization()
            ->getAccounts()
            ->matching($criteria)
        ;
    }
1353476
public static UserProfileDto fromUser(User user) {
    UserProfileDto result = new UserProfileDto();
    result.id = user.getId();
    result.firstName = user.getFirstName();
    result.lastName = user.getLastName();
    result.email = user.getEmail();
    return result;
  }
513621
public function getUser($nb_user)
    {
        $retval = null;

        $nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID);
        if (is_numeric($nb_user_id)) {
            $nb_new_user = new CNabuUser($nb_user_id);
            if ($nb_new_user->isFetched() && $nb_new_user->validateCustomer($this)) {
                $nb_new_user->setCustomer($this);
                $retval = $nb_new_user;
            }
        }

        return $retval;
    }
895705
public UserRecoverRequest requestRecover(User user) {
		if (user == null)
			return null;
		UserRecoverRequest req = new UserRecoverRequest();
		req.setUser(user);
		req.setCreation(new Date());
		req.setCreationIp(this.request.getRemoteAddr());
		req.setExpiration(new Date(System.currentTimeMillis() + 1800000L));
		req.setToken(CryptManager.digest(Math.random() + "@" + System.currentTimeMillis() + "#" + user.getEmail()));
		this.dao.persist(req);
		// TODO Send the recovering email.
		return req;
	}
539386
public final Post withAuthor(final User user) {
      return new Post(id, slug, title, excerpt, content, authorId, user,
              publishTimestamp, modifiedTimestamp, status, parentId,
              guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
   }
366256
public function user($user = 0)
    {
        if (! $this->user->has($user)) {
            $data = new Collection([]);

            $this->user->put($user, $data);
        }

        return $this->user->get($user);
    }
1105301
public function getResourceUserPermission(ResourceInterface $resource, UserInterface $user)
    {
        $query = $this->getRepository()->createQueryBuilder('r')
            ->select('r')
            ->where('r.resource_class = :resourceClass AND r.resource_id=:resourceId AND r.user=:user')
            ->setParameter('resourceClass', $resource->getClass())
            ->setParameter('resourceId', $resource->getId())
            ->setParameter('user', $user)
            ->getQuery();

        return $query->getOneOrNullResult();
    }
387414
public UserResources userResources() {
        if (users.get() == null) {
            users.compareAndSet(null, new UserResourcesImpl(this));
        }
        return users.get();
    }
443161
public boolean allowAccess(String user) {

        try {
            return m_cms.getPermissions(m_root, user).requiresViewPermission();
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            return true;
        }
    }
1048807
public function get(User $user)
    {
        if (null !== $acl = $this->fetchFromCache($user)) {
            return $acl;
        }

        return $this->fetch($user);
    }
914801
public function user($user = null)
    {
        if ($user !== null) {
            $this->user = $user;
        }

        return $this->user;
    }
233355
public function getUserEntity($user)
    {
        if (is_numeric($user)) {
            $userEntity = $this->entityTypeManager
                ->getStorage('user')
                ->load($user);
        } else {
            $userEntities = $this->entityTypeManager
                ->getStorage('user')
                ->loadByProperties(['name' => $user]);
            $userEntity = reset($userEntities);
        }

        return $userEntity;
    }
1189008
public function get($user, ServiceManager $sm) 
	{
		if(!$user instanceof UserEntity) {
			if(is_numeric($user)) {
				$user = $this->find($user);
			} else {
				if(self::CURRENT_KEYWORD == $user) {
				    // @todo Not a wok of the repo, do it in another place!
					$zfcUserAuth = $sm->get('ControllerPluginManager')->get('zfcUserAuthentication');
					$user = $zfcUserAuth->hasIdentity() ? $zfcUserAuth->getIdentity() : null;
					//$user = null;
				} else {
					$user = $this->findByEncryptedId($user, 'userId');
				}
			}
		}
		
		if(!$user instanceof UserEntity) {
			return null;
		}
	
		$userModel = $sm->get('user.model.user');
		$userModel->init($user, $sm);
		
		return $userModel;
	}
534042
public static function getAccessEntitiesForUser($user)
    {
        $entities = [];
        // If the user isnt registered, there is no need to do this anymore.
        if ($user->isRegistered()) {
            $ingids = [];
            $app = Facade::getFacadeApplication();
            /** @var $database \Concrete\Core\Database\Connection\Connection */
            $database = $app->make('database')->connection();

            // First look for any combos that this group would specifically be in.
            // We check if the combos contain any of the groups this user is in.
            // That way if there aren't any we can just skip it.
            foreach ($user->getUserGroups() as $key => $val) {
                $ingids[] = $key;
            }
            $instr = implode(',', $ingids);

            $peIDs = $database->fetchAll(
                'select distinct pae.peID from PermissionAccessEntities pae
                inner join PermissionAccessEntityTypes paet on pae.petID = paet.petID
                inner join PermissionAccessEntityGroups paeg on pae.peID = paeg.peID
                where petHandle = \'group_combination\' 
                and paeg.gID in (' . $instr . ')'
            );
            // Now for each one we check to see if it applies here.
            foreach ($peIDs as $peID) {
                $r = $database->fetchAssoc(
                    'select count(gID) as peGroups, 
                    (select count(UserGroups.gID) from UserGroups where uID = ? 
                      and gID in 
                      (select gID from PermissionAccessEntityGroups where peID = ?))
                     as uGroups from PermissionAccessEntityGroups where peID = ?',
                    [$user->getUserID(), $peID['peID'], $peID['peID']]
                );
                if ($r['peGroups'] == $r['uGroups'] && $r['peGroups'] > 1) {
                    $entity = Entity::getByID($peID['peID']);
                    if (is_object($entity)) {
                        $entities[] = $entity;
                    }
                }
            }
        }

        return $entities;
    }
929778
public UserAccessor getUserAccessor() {
        if (userAccessor != null) {
            return userAccessor;
        }
        userAccessor = (UserAccessor) ContainerManager.getComponent("userAccessor");
        return userAccessor;
    }