Checks to see if the passed in parameter applies to a user or not.

@param string $user_parameter the parameter to be checked.

@return boolean $retval True if the parameter does apply to a user.
769355
protected function isValidUserParameter(string $user_parameter): bool
    {
        $validUserParameters = array(
            'id',
            'user_login',
            'display_name',
            'user_email',
            'user_registered',
            'roles',
            'user_nicename',
            'user_url',
            'user_activation_key',
            'user_status',
            'url'
        );
        return in_array(strtolower($user_parameter), $validUserParameters, true);
    }
65749
function is_user_configured($user = null) {
        global $USER;

        if (is_null($user)) {
            $user = $USER;
        }
        return (bool)get_user_preferences('message_processor_jabber_jabberid', null, $user->id);
    }
1304487
public static function is_token_user_input($t) {
		if (parent::is_token_user_input($t))
			return TRUE;

		if ($t['code'] == T_VARIABLE) {
			if (in_array($t['content'], array(
					'$form', '$form_state'
				)))	return TRUE;
		} elseif ($t['code'] == T_STRING) {
			if (in_array($t['content'], array(
					'arg', 'drupal_get_query_parameters', 'field_view_value'
				))) return TRUE;
		}

		return FALSE;
	}
67946
protected function _check($user, $request, $name, $rule, $params) {
		$message = 'You are not permitted to access this area.';

		if (is_string($rule) && isset($this->_rules[$rule])) {
			$name = $rule;
			$closure = $this->_rules[$rule];
		} elseif (is_array($rule)) {
			if (is_string($name) && isset($this->_rules[$name])) {
				$params += $rule;
				$closure = $this->_rules[$name];
			} else {
				$closure = $rule;
			}
		} elseif (is_callable($rule)) {
			$closure = $rule;
		} else {
			throw new RuntimeException("Invalid rule.");
		}

		if (!is_callable($closure)) {
			$message = isset($closure['message']) ? $closure['message'] : $message;
			$closure = isset($closure['rule']) ? $closure['rule'] : $closure;
		}

		$params += compact('message');
		if(!call_user_func($closure, $user, $request, $params)) {
			$this->_error[$name] = $params['message'];
			return false;
		}
		return true;
	}
1369991
public function checkAccess($p = P, $do = P_DO, $user_id = 0)
    {
        // Guest module can be opened by anyone
        if ($p === 'guest') {
            return true;
        }

        // Only logged-in Users can proceed further
        if (!$this->isLogged()) {
            return false;
        }

        // Get User id
        if (!$user_id) {
            $user_id = USER_ID;
        }

        // Check maybe User have group with full access
        $group_id = $this->getUserData('group_id', $user_id);
        if (self::getInstance()->getGroupData('full_access', $group_id)) {
            return true;
        }

        // Check or init cache
        if (!self::$access) {
            $group_access_collection = new GroupAccessRepository();
            $group_access_collection->setWhereGroupId((int)$group_id);
            foreach ($group_access_collection->getAsArrayOfObjectData() as $group_access) {
                /** @var GroupAccess $group_access */
                self::$access[$group_access['p']][$group_access['do']] = true;
            }
        }

        // Check access for exact admin panel page and action
        return isset(self::$access[$p][$do]);
    }
785807
public static function auth($user_name, $user_pass)
	{
		try
		{
			$ldap_server_address = __SANGRIA_LDAP_SERVER_ADDR__;
			
			$ldapconn = \ldap_connect($ldap_server_address) 
			or $this->throwException("Could not connect to LDAP Server");

			\ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
			\ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

			$ldapbind = @ldap_bind($ldapconn,$user_name,$user_pass);

			if($ldapbind)
			{
				return true;       
			} 
			return false;
		}
		catch(SangriaException $e)
		{
			echo $e->getMessage();
			return false;
		}
	}
1365349
public function hasAccess($accessKey, User $user = null)
    {
        if ($user === null) {
            $user = $this->currentUser();
        }

        if (is_array($accessKey)) {
            return $user->hasAnyAccess($accessKey);
        } else {
            return $user->hasAccess($accessKey);
        }
    }
341624
protected function validateUserIdAddress()
    {
        $field = 'user_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('User');

        if (empty($value) || mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            return true; // Anonymous user
        }

        $user = $this->user->get($value);

        if (empty($user)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
346979
public function checkRouteAccess(string $routeName, $user = null): bool
    {
        if ($user instanceof ModelDecoratorInterface) {
            $user = $user->getModel();
        }
        if (is_null($user)) {
            $user = $this->helper->getCurrentUser();
            if (is_null($user)) {
                if (!is_null($this->debugCollector)) {
                    $this->debugCollector->addPermissionCheck(true, 'route', $routeName, $user, [], [], 'No user was available during this permission check (not even an anonymous user). This usually happens during unit testing. Access was therefore automatically granted.');
                }

                return true;
            }
        }

        if (!$routeName) {
            $this->helper->handleError('Error checking route access: the route_name parameter cannot be empty.', ['route' => $routeName, 'user' => $user]);
            if (!is_null($this->debugCollector)) {
                $this->debugCollector->addPermissionCheck(false, 'route', $routeName, $user, [], [], 'There was an error checking the route access and access was therefore automatically denied. Please refer to the error log for more information.');
            }

            return false;
        }
        if (!is_string($user) && !is_object($user)) {
            $this->helper->handleError('Error checking route access: the user parameter must be either a string or an object.', ['route' => $routeName, 'user' => $user]);
            if (!is_null($this->debugCollector)) {
                $this->debugCollector->addPermissionCheck(false, 'route', $routeName, $user, [], [], 'There was an error checking the route access and access was therefore automatically denied. Please refer to the error log for more information.');
            }

            return false;
        }

        $route = $this->router->getRouteCollection()->get($routeName);
        if (is_null($route)) {
            $this->helper->handleError('Error checking route access: the route could not be found.', ['route' => $routeName, 'user' => $user]);
            if (!is_null($this->debugCollector)) {
                $this->debugCollector->addPermissionCheck(false, 'route', $routeName, $user, [], [], 'There was an error checking the route access and access was therefore automatically denied. Please refer to the error log for more information.');
            }

            return false;
        }

        $permissions = $this->getRoutePermissions($routeName);
        $context = ['route' => $routeName, 'user' => $user];
        $access = $this->la->checkAccess($permissions, $context);

        if (!is_null($this->debugCollector)) {
            $this->debugCollector->addPermissionCheck($access, 'route', $routeName, $user, $permissions, $context);
        }

        return $access;
    }
930036
protected function getCallbackStatus(User $user): bool
    {
        $allCurrentNotificationFilter = $user->getBunqUser()->getNotificationFilters();

        /** @var NotificationFilter $filter */
        foreach ($allCurrentNotificationFilter as $filter) {
            if (
                self::NOTIFICATION_CATEGORY_MUTATION === $filter->getCategory()
                && self::NOTIFICATION_DELIVERY_METHOD_URL === $filter->getNotificationDeliveryMethod()
                && $filter->getNotificationTarget() === $this->getUrl()
            ) {
                return true;
            }
        }

        return false;
    }
309349
public function loadUser($user) {
        global $DB;

        $userid = $user->getRecordId();
        $fields = 'id, resourcelinkid, ltiuserkey, ltiresultsourcedid, created, updated';
        if (!empty($userid)) {
            $row = $DB->get_record($this->userresulttable, ['id' => $userid], $fields);
        } else {
            $resourcelinkid = $user->getResourceLink()->getRecordId();
            $userid = $user->getId(ToolProvider\ToolProvider::ID_SCOPE_ID_ONLY);
            $row = $DB->get_record_select(
                $this->userresulttable,
                "resourcelinkid = ? AND ltiuserkey = ?",
                [$resourcelinkid, $userid],
                $fields
            );
        }
        if ($row) {
            $user->setRecordId($row->id);
            $user->setResourceLinkId($row->resourcelinkid);
            $user->ltiUserId = $row->ltiuserkey;
            $user->ltiResultSourcedId = $row->ltiresultsourcedid;
            $user->created = $row->created;
            $user->updated = $row->updated;
            return true;
        }

        return false;
    }
848840
public function validateThisParameter($parameter_index, $parameter_value) :bool {
		// if a constraint exists for a parameter in that position
		if(isset($this->indexedParametersConstraints[$parameter_index])) {
			// for each of the constraints to check against
			foreach($this->indexedParametersConstraints[$parameter_index] as $constraint_type => $constraint_value) {
				// remove the constraint type value, if we are iterating over a value set without key
				$constraint_type = is_numeric($constraint_type) ? null : $constraint_type;
				// check for each constraint type
				if($constraint_type == 'in_array' && !in_array($parameter_value, $constraint_value)) {
					return false;
				}
				if($constraint_value == 'is_numeric' && !is_numeric($parameter_value)) {
					return false;
				}
				if($constraint_type == '!in_array' && in_array($parameter_value, $constraint_value)) {
					return false;
				}
				if($constraint_value == '!is_numeric' && is_numeric($parameter_value)) {
					return false;
				}
				if($constraint_type == 'preg_match' && !preg_match($constraint_value, $parameter_value)) {
					return false;
				}
				if($constraint_type == '!preg_match' && preg_match($constraint_value, $parameter_value)) {
					return false;
				}
			}
		}
		return true;

	}
1212979
public function verifiedEmail(User $user)
    {
        $this->_prepareEmail($user, __d('wasabi_core', 'Email address verified'));
        $this->_email->template('Wasabi/Core.User/verfied');
        $this->_email->viewVars([
            'user' => $user,
            'instanceName' => Wasabi::getInstanceName()
        ]);
    }
47270
protected function _check(array $user, array $params) {
		if ($this->getConfig('includeAuthentication') && $this->_isPublic($params)) {
			return true;
		}

		if (!$user) {
			return false;
		}

		if ($this->getConfig('superAdmin')) {
			$superAdminColumn = $this->getConfig('superAdminColumn');
			if (!$superAdminColumn) {
				$superAdminColumn = $this->getConfig('idColumn');
			}
			if (!isset($user[$superAdminColumn])) {
				throw new Exception('Missing super Admin Column in user table');
			}
			if ($user[$superAdminColumn] === $this->getConfig('superAdmin')) {
				return true;
			}
		}

		// Give any logged in user access to ALL actions when `allowUser` is
		// enabled except when the `adminPrefix` is being used.
		if ($this->getConfig('allowUser')) {
			if (empty($params['prefix'])) {
				return true;
			}
			if ($params['prefix'] !== $this->getConfig('adminPrefix')) {
				return true;
			}
		}

		$userRoles = $this->_getUserRoles($user);

		// Allow access to all prefixed actions for users belonging to
		// the specified role that matches the prefix.
		if ($this->getConfig('authorizeByPrefix') && !empty($params['prefix'])) {
			if (in_array($params['prefix'], $this->getConfig('prefixes'))) {
				$roles = $this->_getAvailableRoles();
				$role = isset($roles[$params['prefix']]) ? $roles[$params['prefix']] : null;
				if ($role && in_array($role, $userRoles)) {
					return true;
				}
			}
		}

		// Allow logged in super admins access to all resources
		if ($this->getConfig('superAdminRole')) {
			foreach ($userRoles as $userRole) {
				if ((string)$userRole === (string)$this->getConfig('superAdminRole')) {
					return true;
				}
			}
		}

		if ($this->_acl === null) {
			$this->_acl = $this->_getAcl($this->getConfig('aclFilePath'));
		}

		// Allow access if user has a role with wildcard access to the resource
		$iniKey = $this->_constructIniKey($params);
		if (isset($this->_acl[$iniKey]['actions']['*'])) {
			$matchArray = $this->_acl[$iniKey]['actions']['*'];
			foreach ($userRoles as $userRole) {
				if (in_array((string)$userRole, $matchArray)) {
					return true;
				}
			}
		}

		// Allow access if user has been granted access to the specific resource
		if (isset($this->_acl[$iniKey]['actions'])) {
			if (array_key_exists($params['action'], $this->_acl[$iniKey]['actions']) && !empty($this->_acl[$iniKey]['actions'][$params['action']])) {
				$matchArray = $this->_acl[$iniKey]['actions'][$params['action']];
				foreach ($userRoles as $userRole) {
					if (in_array((string)$userRole, $matchArray)) {
						return true;
					}
				}
			}
		}
		return false;
	}
1079301
public function hasAccess(array $url, array $user): bool
    {
        $result = parent::hasAccess($url, $user);
        if (!$result) {
            return $result;
        }

        if (!empty($user['is_superuser']) && $user['is_superuser']) {
            return true;
        }

        return false;
    }
736395
public static function find_trusted_emails($user_id)
	{
		if (empty($user_id) || !is_numeric($user_id))
		{
			return false;
		}

		$results = self::all()
			->whereEquals('user_id', $user_id)
			->rows()
			->fieldsByKey('email');

		if (empty($results))
		{
			return false;
		}

		return $results;
	}
727845
public function hasGuide(User $user)
    {
        $isGuide = false;

        foreach ($this->getPortfolioGuides() as $portfolioGuide) {
            if ($user->getId() === $portfolioGuide->getUser()->getId()) {
                $isGuide = true;
                break;
            }
        }

        return $isGuide;
    }