Erstellung alle Agenturinfos vorbereitet

This commit is contained in:
holger.trampe 2021-06-04 17:01:59 +02:00
parent 1866ec1c5a
commit f8cc944491
1 changed files with 26 additions and 3 deletions

View File

@ -57,6 +57,10 @@ use \OCP\IConfig;
use \OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;
// DEFAULT GROUP DIRs with Permissions!
use OCP\IDBConnection;
use OCA\GroupFolders\Folder\FolderManager;
class RegistrationService {
/** @var string */
@ -91,6 +95,12 @@ class RegistrationService {
private $tokenProvider;
/** @var ICrypto */
private $crypto;
/** @var IDBConnection */
private $connection;
public function __construct(
string $appName,
@ -104,11 +114,12 @@ class RegistrationService {
IGroupManager $groupManager,
ISecureRandom $random,
IUserSession $userSession,
IRequest $request,
LoggerInterface $logger,
ISession $session,
IProvider $tokenProvider,
ICrypto $crypto
ICrypto $crypto,
IRequest $request,
IDBConnection $connection
) {
$this->appName = $appName;
$this->mailService = $mailService;
@ -126,6 +137,7 @@ class RegistrationService {
$this->session = $session;
$this->tokenProvider = $tokenProvider;
$this->crypto = $crypto;
$this->connection = $connection;
}
public function confirmEmail(Registration $registration): void {
@ -436,10 +448,21 @@ class RegistrationService {
$groupidfree = true;
}
}
$newgroup = $this->groupManager->createGroup($newgid.$newgid_counter);
$newgroup->addUser($user);
// Create two new Directorys for that agency
$folderManager = new FolderManager($this->connection, $this->groupManager);
// Main-Dir for complete Agency
$newFolderId = $folderManager->createFolder('Agenturdaten');
$folderManager->addApplicableGroup($newFolderId, $newgroup->getGId());
$folderManager->setGroupPermissions($newFolderId, $newgroup->getGId(), '31');
// Upload-Standard-Directory
$newFolderId = $folderManager->createFolder('Standard Uploadbereich');
$folderManager->addApplicableGroup($newFolderId, $newgroup->getGId());
$folderManager->setGroupPermissions($newFolderId, $newgroup->getGId(), '31');
// disable user if this is requested by config
$adminApprovalRequired = $this->config->getAppValue($this->appName, 'admin_approval_required', 'no');