Determine if the current user can view users.

@param mixed $user

@return bool
499442
public function view($user)
    {
        $user = User::findOrFail($user->id);

        return $user->hasPermission('laralum::users.view') || $user->superAdmin();
    }
1200392
public function is_available(User $user)
    {
        if (! $this->app['registration.manager']->isRegistrationEnabled()) {
            return false;
        }

        return $this->app->getAclForUser($user)->has_right(\ACL::CANADMIN);
    }
1109636
public function isAuthenticated($user = null)
    {
        $user = $user ?: $this->getUser();

        return $this->isGranted('IS_AUTHENTICATED_FULLY', $user) || $this->isGranted('IS_AUTHENTICATED_REMEMBERED', $user);
    }
536456
public function can_subscribe_to_forum(stdClass $user) : bool {
        if ($this->forum->get_type() == 'single') {
            return false;
        }

        return !is_guest($this->get_context(), $user) &&
            subscriptions::is_subscribable($this->get_forum_record());
    }
115241
protected function userHasAccess($member)
    {
        if (!$member) {
            if (!Security::getCurrentUser()) {
                return false;
            }
            $member = Security::getCurrentUser();
        }

        if (Permission::checkMember($member, "VIEW_ACTIVE_WORKFLOWS")) {
            return true;
        }
    }
233462
public function publicView($user, Ticket $ticket)
    {
        if ($ticket->user_id == $user->id) {
            return User::findOrFail($user->id)->hasPermission('laralum::tickets.view-public');
        }

        return false;
    }
681834
public function hasResponsible($user)
    {
        return $this->users()->where('user_id', $user->id)->first()->pivot->responsible;
    }
107961
public function can_access_group(stdClass $user, int $groupid) : bool {
        if ($this->can_access_all_groups($user)) {
            // This user has access to all groups.
            return true;
        }

        // This is a group discussion for a forum in separate groups mode.
        // Check if the user is a member.
        // This is the most expensive check.
        return groups_is_member($groupid, $user->id);
    }
465000
public function isAuthorized($user = null) {
        parent::isAuthorized($user);

        if (!$this->Acl->check(array(USER_MODEL => $user), $this->Model->qualifiedName, 'read')) {
            throw new UnauthorizedException(__d('admin', 'Insufficient Access Permissions'));
        }

        return true;
    }
629119
public function isAuthorized($user)
    {
        $this->Authorizer->action(['*'], function ($auth, $user) {
            $auth->allowRole([1]);
        });

        return $this->Authorizer->authorize();
    }
897116
public function canView($member = null) {
		if(!$member) $member = Member::currentUser();
		if(!$member) return false; // Must be logged in to check permissions

		if(Permission::checkMember($member, 'ADMIN')) return true;

		// if no Viewers or ViewerGroups defined, fallback to DNProject::canView permissions
		if($this->Viewers()->exists() || $this->ViewerGroups()->exists()) {
			return $this->Viewers()->byID($member->ID)
				|| $member->inGroups($this->ViewerGroups());
		}

		return $this->Project()->canView($member);
	}
706564
public function delete_user(string $user): bool
	{
		if ( bbn\str::check_name($user) ){
			$this->db->raw_query("
			REVOKE ALL PRIVILEGES ON *.*
			FROM $user");
			return (bool)$this->db->query("DROP USER $user");
		}
		return false;
	}
253882
public function remove($user)
    {
        $this->load();
        if (!isset($this->users[$user])) {
            return false;
        }
        unset($this->users[$user]);
        return true;
    }
762566
protected function can(string $action, ?Authorizable $user = null): bool
    {
        return ! \is_null($user)
                    ? $this->acl->canAs($user, $action)
                    : $this->acl->can($action);
    }
208858
public function whereIsAccessible($user)
    {
        $currentDate = new \DateTime();
        $clause = '(
            creator.id = :creatorId
            OR (
                node.published = true
                AND (node.accessibleFrom IS NULL OR node.accessibleFrom <= :currentdate)
                AND (node.accessibleUntil IS NULL OR node.accessibleUntil >= :currentdate)
            )
        )';
        $this->addWhereClause($clause);
        $this->parameters[':creatorId'] = ($user === 'anon.') ? -1 : $user->getId();
        $this->parameters[':currentdate'] = $currentDate->format('Y-m-d H:i:s');

        return $this;
    }
334328
public function isAllowed($instance, $user)
    {
        if ($user) {
            if (!is_string($instance)) {
                if ($instance->admin && $user->admin === false) {
                    return false;
                }
                // El admin tiene acceso a cualquier pagina
                if ($user->admin === 1) {
                    return true;
                }
            }
            $page = new Page();
            $current = $page->get_by_controller($instance);
            if ($current && $current->count() > 0) {
                $result = $this->getByPageUser($user->id, $current->getModel()->id);
                if ($result->count() > 0) {
                    return $result->getModel()->allowed;
                }
            } else {
                return false;
            }
        }

        return true;
    }
355317
public function index(User $user)
    {
        $data = [];
        if ($user->id) {
            //Requesting another user profile
            if ( $user->identifiableName() === Auth::user()->id || Auth::user()->can('see-other-users-profile')) {
                $data = $user->toArray();
            } else {
                abort(403);
            }
        }
        return view('acacha_users::profile', $data);
    }