Perform a security check
181631
public function init() {
		parent::init();
		if ($this->event->RequireLoggedIn && !Member::currentUserID()) {
			return Security::permissionFailure($this, array(
				'default' => 'Please log in to register for this event.'
			));
		}
	}
54161
def validate(self):
        """"""

        if not self.server.enabled:

            if self.security.signature_certificate_file is self.security.defaults['signature_certificate_file']:
                print("ISSUE: If you are not configuring a server, you need to set 'signature_certificate_file'")

            if self.security.signature_private_key_file is self.security.defaults['signature_private_key_file']:
                print("ISSUE: If you are not configuring a server, you need to set 'signature_private_key_file'")

        else:

            if self.client.enabled:
                print("ISSUE: Client and server enabled at the same time?")

            if self.server.protocol is self.server.defaults['protocol']:
                if self.server.server_certificate_file is self.server.defaults['server_certificate_file'] or \
                                self.server.server_private_key_file is self.server.defaults['server_private_key_file']:
                   print("ISSUE: 'server_certificate_file' and/or 'server_private_key_file' are not configured and will be auto-generated.")


            if self.server.certification_authority_certificate_file is self.server.defaults['certification_authority_certificate_file'] or \
                            self.server.certification_authority_private_key_file is self.server.defaults['certification_authority_private_key_file']:
                print("ISSUE: 'certification_authority_certificate_file' and/or 'certification_authority_private_key_file' are not configured and will be auto-generated - this is NOT recommended.")

            if self.server.authentication_script is self.server.defaults['authentication_script']:
                print("ISSUE: No 'authentication_script' has been provided and all authentication requests will be rejected!")

        if self.client.enabled:

            if self.client.server_endpoint is self.client.defaults['server_endpoint']:
                print("ISSUE: You are running in client mode, but you are using a default server address.")

            if not self.client.disable_peer_verification is self.client.defaults['disable_peer_verification'] or \
                    not self.client.disable_host_verification is self.client.defaults['disable_host_verification']:
                print("ISSUE: Disabling peer/host verification is NOT recommended - AT ALL.")

            if self.client.username is self.client.defaults['username'] or \
                            self.client.password is self.client.defaults['password']:
                print("ISSUE: No username and/or password has been configured for a client.")

        if self.fscp.contact is self.fscp.defaults['contact']:

            if not self.server.enabled and not self.client.enabled:
                print("ISSUE: You have not defined any contact points while you are neither running as server nor client.")

        ## hostname_resolution_protocol=ipv4/ipv6
        ## ipv4_address_prefix_length=9.0.0.1/24
        ## ipv6_address_prefix_length=2aa1::1/8

        if self.security.authority_certificate_file is self.security.defaults['authority_certificate_file']:
            print("ISSUE: You need to set 'authority_certificate_file'")

        if self.tap_adapter.ipv4_address_prefix_length is self.tap_adapter.defaults['ipv4_address_prefix_length']:
            print("ISSUE: You are using the default network address - make sure you set a different ip for every machine 'ipv4_address_prefix_length'")
1259809
public static function check() {
		if (R::count("user") < 1) {
			$pwdbname             = setup::getValidation("password");
			$userdbname           = setup::getValidation("username");
			$guest                = R::dispense("user");
			$guest->{$userdbname} = "guest";
			$guest->{$pwdbname}   = "";
			$guest->role          = role::get("guest");
			R::store($guest);
		}
	}
249459
def check_in(request, action):
    """"""
    if not request:
        req_str = ""
        for idx, val in enumerate(actions[action]):
            req_str += "\n" + val
        erstr = "Provide a request dict with the following properties:" \
                " %s" % req_str
        raise ValueError(erstr)

    required_fields = actions[action]
    missing = []
    for field in required_fields:
        if not is_key_present(request, field):
            missing.append(field)
    if missing:
        missing_string = ""
        for idx, val in enumerate(missing):
            missing_string += "\n" + val
        erstr = "Provide the required request parameters to" \
                " complete this request: %s" % missing_string
        raise ValueError(erstr)

    return True
708804
private static function check() {

        foreach(['openssl'] as $extension) {

            if(false === extension_loaded($extension)) {
                return trigger_error(sprintf('Extension "%s" should be loaded to use %s', $extension, __CLASS__), E_USER_ERROR);
            }
        }
    }
383726
def verify_security_data(security):
    
    random_token = security[TOKEN_RANDOM]
    hashed_token = security[TOKEN_HASHED]
    return str(hashed_token) == str(compute_token(random_token))
1224869
def check_user(user, password):
    """"""
    return ((user == attowiki.user or attowiki.user is None) and
            (password == attowiki.password or attowiki.password is None))
263737
protected function checkUserSecurity()
    {
        $allowedGroup = $this->property('security', self::ALLOW_ALL);
        $allowedUserGroups = $this->property('allowedUserGroups', []);
        $isAuthenticated = Auth::check();

        if ($isAuthenticated) {
            if ($allowedGroup == self::ALLOW_GUEST) {
                return false;
            }

            if (!empty($allowedUserGroups)) {
                $userGroups = Auth::getUser()->groups->lists('code');
                if (!count(array_intersect($allowedUserGroups, $userGroups))) {
                    return false;
                }
            }
        }
        else {
            if ($allowedGroup == self::ALLOW_USER) {
                return false;
            }
        }

        return true;
    }
1223422
def check_for_additional_actions(self, url_params: dict,
                                     html: str,
                                     login_data: dict) -> None:
        
        action_response = ''
        if 'sid' in url_params:
            action_response = self.handle_captcha(url_params, html, login_data)
        elif 'authcheck' in url_params:
            action_response = self.handle_two_factor_check(html)
        elif 'security_check' in url_params:
            action_response = self.handle_phone_number_check(html)
        if action_response:
            check_page_for_warnings(action_response.text)
137340
public function checkBE()
	{
	    if ($this->isContao45()) 
	    {
	        if ($this->_BackendUser)
	        {
                ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': True' );
                return true;
	        }
	        ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': False' );
	        return false;
	    }
		//Contao <4.5.0
	    $strCookie = 'BE_USER_AUTH';
		$hash = sha1(session_id() . (!\Config::get('privacyAnonymizeIp') ? \Environment::get('ip') : '') . $strCookie);
		if (\Input::cookie($strCookie) == $hash)
		{
			// Try to find the session
			$objSession = \SessionModel::findByHashAndName($hash, $strCookie);
			// Validate the session ID and timeout
			if ($objSession !== null && $objSession->sessionID == session_id() && (\Config::get('privacyAnonymizeIp') || $objSession->ip == \Environment::get('ip')) && ($objSession->tstamp + $GLOBALS['TL_CONFIG']['sessionTimeout']) > time())
			{
			    ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': True' );
				return true;
			}
		}
		ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': False' );
		return false;
	}
984114
def _check_permission(self, request):
        

        if self.access_controller:
            self.access_controller.check_perm(request, self)
725284
def checkin(self):
        """"""
        self._query_instance.checkin(self.place_id,
                                     self._query_instance.sensor)
1167716
def run_check(self, check, argument_names):
        """"""
        arguments = []
        for name in argument_names:
            arguments.append(getattr(self, name))
        return check(*arguments)
91085
public function check() {
		foreach ( $this->requirements as $requirement ) {
			// Match against config.
			$requirementFulfilled = $this->requirementIsFulfilled( $requirement );

			if ( $requirementFulfilled ) {
				continue;
			}

			$this->addMissingRequirementMessage( $requirement );
		}
	}
813798
def check (self):
        """"""
        if self.aggregate.config["trace"]:
            trace.trace_on()
        try:
            self.local_check()
        except (socket.error, select.error):
            # on Unix, ctrl-c can raise
            # error: (4, 'Interrupted system call')
            etype, value = sys.exc_info()[:2]
            if etype == errno.EINTR:
                raise KeyboardInterrupt(value)
            else:
                raise
969493
public static function check() {
		if (R::count("role") < 1) {
			$role                                = R::dispense("role");
			$role->name                          = "guest";
			$per                                 = new permission("guest");
			$role->role->sharedPermissionList [] = $per->get();
			R::store($role);
		}
	}
1324316
def do_thing():
    """"""
    if len(sys.argv) == 5 and sys.argv[1] == "encrypt_file":
        encrypt_file(sys.argv[2], sys.argv[3], sys.argv[4])
    elif len(sys.argv) == 4 and sys.argv[1] == "decrypt_file":
        decrypt_file(sys.argv[2], sys.argv[3])
    elif len(sys.argv) == 3 and sys.argv[1] == "encrypt":
        encrypt_var(sys.argv[2])
    elif len(sys.argv) == 2 and sys.argv[1] == "decrypt":
        decrypt_var()
    elif len(sys.argv) == 3 and sys.argv[1] == "decrypt":
        decrypt_var(passphrase=sys.argv[2])
    elif len(sys.argv) == 3 and sys.argv[1] == "has_key":
        has_key(sys.argv[2])
    elif len(sys.argv) == 3 and sys.argv[1] == "import_keybase":
        import_keybase(sys.argv[2])
    elif len(sys.argv) == 3 and sys.argv[1] == "export":
        export_key(sys.argv[2])
    else:
        print("Cryptorito testing wrapper. Not suitable for routine use.",
              file=sys.stderr)
        sys.exit(1)