vorbereitung migration

This commit is contained in:
holger.trampe 2021-07-23 11:56:12 +02:00
parent 898a52fa5f
commit 9ab5c457ae
1 changed files with 11 additions and 4 deletions

View File

@ -61,6 +61,7 @@ use Psr\Log\LoggerInterface;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCA\GroupFolders\Folder\FolderManager; use OCA\GroupFolders\Folder\FolderManager;
use OCA\Agency\Agency\AgencyManager; use OCA\Agency\Agency\AgencyManager;
use OCA\Agency\Service\GroupPermissionService;
class RegistrationService { class RegistrationService {
@ -103,6 +104,8 @@ class RegistrationService {
/** @var AgencyManager */ /** @var AgencyManager */
private $agencyManager; private $agencyManager;
/** @var GroupPermissionService */
private $groupPermissionService;
public function __construct( public function __construct(
@ -123,7 +126,8 @@ class RegistrationService {
ICrypto $crypto, ICrypto $crypto,
IRequest $request, IRequest $request,
IDBConnection $connection, IDBConnection $connection,
AgencyManager $agencyManager AgencyManager $agencyManager,
GroupPermissionService $groupPermissionService
) { ) {
$this->appName = $appName; $this->appName = $appName;
$this->mailService = $mailService; $this->mailService = $mailService;
@ -143,6 +147,7 @@ class RegistrationService {
$this->crypto = $crypto; $this->crypto = $crypto;
$this->connection = $connection; $this->connection = $connection;
$this->agencyManager = $agencyManager; $this->agencyManager = $agencyManager;
$this->groupPermissionService = $groupPermissionService;
} }
public function confirmEmail(Registration $registration): void { public function confirmEmail(Registration $registration): void {
@ -390,7 +395,7 @@ class RegistrationService {
} }
} }
/* TODO /* BUG
* createUser tests username validity once, but validateUsername already checked it, * createUser tests username validity once, but validateUsername already checked it,
* but createUser doesn't check if there is a pending registration with that name * but createUser doesn't check if there is a pending registration with that name
* *
@ -470,15 +475,17 @@ class RegistrationService {
$newgroup = $this->groupManager->createGroup($newgid); $newgroup = $this->groupManager->createGroup($newgid);
$newgroup->setDisplayName("Mitarbeiter"); $newgroup->setDisplayName("Mitarbeiter");
$newgroup->addUser($user); $newgroup->addUser($user);
$this->groupPermissionService->create($newgid);
//TODO: Checken, ob das hier klappt mit der zusätzlichen Gruppe!
$newgroup_al = $this->groupManager->createGroup($newgid."_defaultal"); $newgroup_al = $this->groupManager->createGroup($newgid."_defaultal");
$newgroup_al->setDisplayName("Agenturleiter"); $newgroup_al->setDisplayName("Agenturleiter");
$newgroup_al->addUser($user); $newgroup_al->addUser($user);
$this->groupPermissionService->create($newgid."_defaultal");
$newgroup_admins = $this->groupManager->createGroup($newgid."_defaultadmingroup"); $newgroup_admins = $this->groupManager->createGroup($newgid."_defaultadmingroup");
$newgroup_admins->setDisplayName("Administratoren"); $newgroup_admins->setDisplayName("Administratoren");
$newgroup_admins->addUser($user); $newgroup_admins->addUser($user);
$this->groupPermissionService->create($newgid."_defaultadmingroup", "{'mainsettings':true, 'structure': true, 'usersandgroups':true");
// Create default Dirs // Create default Dirs
$folderManager = new FolderManager($this->connection, $this->groupManager); $folderManager = new FolderManager($this->connection, $this->groupManager);