federator/plugins/dummyconnector.php

44 lines
1017 B
PHP

<?php
/**
* SPDX-FileCopyrightText: 2024 Sascha Nitsch (grumpydeveloper) https://contentnation.net/@grumpydevelop
* SPDX-License-Identifier: GPL-3.0-or-later
* @author Author: Sascha Nitsch (grumpydeveloper)
**/
namespace Federator;
/**
* dummy connector that always return the same permission
*/
class DummyConnector implements Connector\Connector
{
/**
* constructor
*/
public function __construct()
{
}
/**
* get remote user by given session
* @param string $_session session id
* @param string $_user user or profile name
* @return Data\User | false
*/
public function getRemoteUserBySession(string $_session, string $_user)
{
// validate $_session and $user
$user = new Data\User();
$user->id = $_user;
$user->permissions = ['PUBLISH'];
$user->session = $_session;
return $user;
}
}
function dummy_load(Main $main)
{
$dummy = new DummyConnector();
$main->setConnector($dummy);
}