2024-07-15 20:46:44 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* SPDX-FileCopyrightText: 2024 Sascha Nitsch (grumpydeveloper) https://contentnation.net/@grumpydevelop
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
* @author Author: Sascha Nitsch (grumpydeveloper)
|
|
|
|
**/
|
|
|
|
|
2024-07-17 15:45:19 +02:00
|
|
|
namespace Federator\Connector;
|
2024-07-15 20:46:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* dummy connector that always return the same permission
|
|
|
|
*/
|
2024-07-17 15:45:19 +02:00
|
|
|
class DummyConnector implements Connector
|
2024-07-15 20:46:44 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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
|
2024-07-17 15:45:19 +02:00
|
|
|
$user = new \Federator\Data\User();
|
2024-07-15 20:46:44 +02:00
|
|
|
$user->id = $_user;
|
|
|
|
$user->permissions = ['PUBLISH'];
|
|
|
|
$user->session = $_session;
|
|
|
|
return $user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-17 15:45:19 +02:00
|
|
|
namespace Federator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to initialize plugin
|
|
|
|
*
|
|
|
|
* @param \Federator\Main $main main instance
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function dummy_load($main)
|
2024-07-15 20:46:44 +02:00
|
|
|
{
|
2024-07-17 15:45:19 +02:00
|
|
|
$dummy = new Connector\DummyConnector();
|
2024-07-15 20:46:44 +02:00
|
|
|
$main->setConnector($dummy);
|
|
|
|
}
|