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 \OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
// DEFAULT GROUP DIRs with Permissions!
use OCP\IDBConnection;
use OCA\GroupFolders\Folder\FolderManager;
class RegistrationService { class RegistrationService {
/** @var string */ /** @var string */
@ -92,6 +96,12 @@ class RegistrationService {
/** @var ICrypto */ /** @var ICrypto */
private $crypto; private $crypto;
/** @var IDBConnection */
private $connection;
public function __construct( public function __construct(
string $appName, string $appName,
MailService $mailService, MailService $mailService,
@ -104,11 +114,12 @@ class RegistrationService {
IGroupManager $groupManager, IGroupManager $groupManager,
ISecureRandom $random, ISecureRandom $random,
IUserSession $userSession, IUserSession $userSession,
IRequest $request,
LoggerInterface $logger, LoggerInterface $logger,
ISession $session, ISession $session,
IProvider $tokenProvider, IProvider $tokenProvider,
ICrypto $crypto ICrypto $crypto,
IRequest $request,
IDBConnection $connection
) { ) {
$this->appName = $appName; $this->appName = $appName;
$this->mailService = $mailService; $this->mailService = $mailService;
@ -126,6 +137,7 @@ class RegistrationService {
$this->session = $session; $this->session = $session;
$this->tokenProvider = $tokenProvider; $this->tokenProvider = $tokenProvider;
$this->crypto = $crypto; $this->crypto = $crypto;
$this->connection = $connection;
} }
public function confirmEmail(Registration $registration): void { public function confirmEmail(Registration $registration): void {
@ -440,6 +452,17 @@ class RegistrationService {
$newgroup = $this->groupManager->createGroup($newgid.$newgid_counter); $newgroup = $this->groupManager->createGroup($newgid.$newgid_counter);
$newgroup->addUser($user); $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 // disable user if this is requested by config
$adminApprovalRequired = $this->config->getAppValue($this->appName, 'admin_approval_required', 'no'); $adminApprovalRequired = $this->config->getAppValue($this->appName, 'admin_approval_required', 'no');