mc-cms-namelessmc/core/classes/Integrations/IntegrationUser.php

180 lines
5.3 KiB
PHP
Raw Permalink Normal View History

User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
<?php
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
/**
* Represents a integration user.
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
*
* @package NamelessMC\Integrations
* @author Partydragen
* @version 2.0.0-pr13
* @license MIT
*/
class IntegrationUser
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
private DB $_db;
2022-05-11 23:44:22 -06:00
private IntegrationUserData $_data;
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
private User $_user;
private IntegrationBase $_integration;
public function __construct(IntegrationBase $integration, ?string $value = null, string $field = 'id', $query_data = null)
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
$this->_db = DB::getInstance();
$this->_integration = $integration;
if (!$query_data && $value) {
$field = preg_replace('/[^A-Za-z_]+/', '', $field);
2022-05-01 23:16:22 -07:00
$data = $this->_db->query("SELECT * FROM nl2_users_integrations WHERE $field = ? AND integration_id = ?", [$value, $integration->data()->id]);
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
if ($data->count()) {
2022-05-11 23:44:22 -06:00
$this->_data = new IntegrationUserData($data->first());
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
} elseif ($query_data) {
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
// Load data from existing query.
2022-05-11 23:44:22 -06:00
$this->_data = new IntegrationUserData($query_data);
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
}
/**
* Get the integration.
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
*
* @return IntegrationBase Integration type for this user
*/
public function getIntegration(): IntegrationBase
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
return $this->_integration;
}
/**
* Get the NamelessMC User that belong to this integration user.
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
*
* @return User NamelessMC User that belong to this integration user
*/
public function getUser(): User
{
2022-07-08 22:49:22 -06:00
return $this->_user ??= new User($this->data()->user_id);
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
/**
* Get the integration user data.
*
2022-05-11 23:44:22 -06:00
* @return IntegrationUserData This integration user data.
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
*/
public function data(): IntegrationUserData
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
return $this->_data;
}
/**
* Does this integration user exist?
*
* @return bool Whether the user exists (has data) or not.
*/
public function exists(): bool
{
return !empty($this->_data);
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
/**
* Get if this integration user is verified or not.
*
* @return bool Whether this integration user has been verified.
*/
public function isVerified(): bool
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
return $this->data()->verified;
}
/**
* Update integration user data in the database.
*
* @param array $fields Column names and values to update.
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
* @throws Exception
*/
public function update(array $fields = []): void
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
if (!$this->_db->update('users_integrations', $this->data()->id, $fields)) {
throw new RuntimeException('There was a problem updating integration user.');
}
// Sync username to website username?
if (isset($fields['username']) && Settings::get('username_sync') == $this->data()->integration_id) {
if (Settings::get('displaynames') === '1') {
$this->getUser()->update([
'username' => $fields['username'],
]);
} else {
$this->getUser()->update([
'username' => $fields['username'],
'nickname' => $fields['username'],
]);
}
}
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
/**
* Save a new user linked to a specific integration.
*
* @param User $user The user to link
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
* @param string|null $identifier The id of the integration account
* @param string|null $username The username of the integration account
* @param bool $verified Verified the ownership of the integration account
* @param string|null $code (optional) The verification code to verify the ownership
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
*/
public function linkIntegration(User $user, ?string $identifier, ?string $username, bool $verified = false, ?string $code = null): void
{
2022-05-01 23:16:22 -07:00
$this->_db->query(
'INSERT INTO nl2_users_integrations (user_id, integration_id, identifier, username, verified, date, code) VALUES (?, ?, ?, ?, ?, ?, ?)',
[
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
$user->data()->id,
$this->_integration->data()->id,
Output::getClean($identifier),
Output::getClean($username),
$verified ? 1 : 0,
date('U'),
$code,
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
]
);
// Load the data for this integration from the query we just made
$this->_data = new IntegrationUserData($this->_db->query('SELECT * FROM nl2_users_integrations WHERE id = ?', [$this->_db->lastId()])->first());
EventHandler::executeEvent(new UserIntegrationLinkedEvent(
$this,
));
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
/**
* Verify user integration.
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
*/
public function verifyIntegration(): void
{
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
$this->update([
2022-05-31 11:29:47 -06:00
'verified' => true,
'code' => null,
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
]);
$this->_integration->onSuccessfulVerification($this);
EventHandler::executeEvent(new UserIntegrationVerifiedEvent(
$this,
));
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
/**
* Delete integration user data.
*/
public function unlinkIntegration(): void
{
2022-05-01 23:16:22 -07:00
$this->_db->query(
'DELETE FROM nl2_users_integrations WHERE user_id = ? AND integration_id = ?',
[
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
$this->data()->user_id,
$this->_integration->data()->id,
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
]
);
EventHandler::executeEvent(new UserIntegrationUnlinkedEvent(
$this,
));
User Integrations systems (#2606) * Initial work for User Integrations systems * Convert a few endpoints to new user integration system * Finish minecraft part to new User Integration system * Fixes verify banner issue https://github.com/NamelessMC/Nameless/issues/2052 Fixes https://github.com/NamelessMC/Nameless/issues/2052 * Convert discord to new user integrations system * Update fields to show user integrations * Add user integrations to StaffCP user page / move over * Update UserInfo and Rename MinecraftVerify endpoint * Rework user listing endpoint * Password check never returns null * Add support for offline mode uuid * Fix documentation phpstan warnings * else if * remove die() * Revamp registration page * add integrations settings page * Convert authme & fix phpstan issues * refix settings page * Load uuid when user is loaded * Redirect user to complete required integrations * Fix translation for user connections page * Rework integrations registration in Register Endpoint Completes https://github.com/NamelessMC/Nameless/issues/2516 * make getIntegration ignore case sensitive * Update installer * Update upgrader script to convert users * Fix index for user integrations * Remove uuid from user data * Misc * Remove one unused query * Add event for integration linking, verify and unlink * Finish user transformer, Finish user integrations * Thx phpstan * Fix phpdocs * Fix user reports page * Remove validation banner * Change default field value * resolve samerton feedback * don't clean when inserting data * don't clean event data * remove more clean * increase reset_code length from 60 to 64 * pr13 confirmed * one more clean * Remove API verification setting * Register integrations edit permission * Resolve a few requested changes * Rework username and identifier validation * Add button to sync user integration * Fix Synchronisation text * Fix is verified term Co-authored-by: Robin <robinslot@hotmail.nl> Co-authored-by: Robin <robin+git@rkslot.nl>
2022-04-16 18:42:24 +02:00
}
}