403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.216.43
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/kanboard/app/Core/User/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/kanboard/app/Core/User/UserSync.php
<?php

namespace Kanboard\Core\User;

use Kanboard\Core\Base;
use Kanboard\Notification\MailNotification;
use Kanboard\Notification\WebNotification;

/**
 * User Synchronization
 *
 * @package  user
 * @author   Frederic Guillot
 */
class UserSync extends Base
{
    /**
     * Synchronize user profile
     *
     * @access public
     * @param  UserProviderInterface $user
     * @return array|null
     */
    public function synchronize(UserProviderInterface $user)
    {
        $profile = $this->userModel->getByExternalId($user->getExternalIdColumn(), $user->getExternalId());
        $properties = UserProperty::getProperties($user);

        if (! empty($profile)) {
            $profile = $this->updateUser($profile, $properties);
        } elseif ($user->isUserCreationAllowed()) {
            $profile = $this->createUser($user, $properties);
        }

        return $profile;
    }

    /**
     * Update user profile
     *
     * @access public
     * @param  array    $profile
     * @param  array    $properties
     * @return array
     */
    private function updateUser(array $profile, array $properties)
    {
        $values = UserProperty::filterProperties($profile, $properties);

        if (! empty($values)) {
            $values['id'] = $profile['id'];
            $result = $this->userModel->update($values);
            return $result ? array_merge($profile, $properties) : $profile;
        }

        return $profile;
    }

    /**
     * Create user
     *
     * @access public
     * @param  UserProviderInterface  $user
     * @param  array                  $properties
     * @return array
     */
    private function createUser(UserProviderInterface $user, array $properties)
    {
        $userId = $this->userModel->create($properties);

        if ($userId === false) {
            $this->logger->error('Unable to create user profile: '.$user->getExternalId());
            return array();
        }

        if ($this->configModel->get('notifications_enabled', 0) == 1) {
            $this->userNotificationTypeModel->saveSelectedTypes($userId, [MailNotification::TYPE, WebNotification::TYPE]);
        }

        return $this->userModel->getById($userId);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit