Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
0491fb26
Commit
0491fb26
authored
Mar 02, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show modal role choice first time user logs in with a prestataire enabled
parent
d30ccaea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
User.php
src/Entity/User.php
+14
-0
Version20240302095543.php
src/Migrations/Version20240302095543.php
+33
-0
AppExtension.php
src/Twig/AppExtension.php
+17
-0
No files found.
src/Entity/User.php
View file @
0491fb26
...
@@ -826,4 +826,18 @@ class User extends BaseUser
...
@@ -826,4 +826,18 @@ class User extends BaseUser
return
$this
;
return
$this
;
}
}
/**
* @var bool
* @ORM\Column(type="boolean", nullable=false, options={"default" : true})
*/
private
bool
$beforeFirstLoginWithPrestaEnabled
;
public
function
getBeforeFirstLoginWithPrestaEnabled
()
:
bool
{
return
$this
->
beforeFirstLoginWithPrestaEnabled
;
}
public
function
setBeforeFirstLoginWithPrestaEnabled
(
$var
)
{
$this
->
beforeFirstLoginWithPrestaEnabled
=
$var
;
}
}
}
src/Migrations/Version20240302095543.php
0 → 100644
View file @
0491fb26
<?php
declare
(
strict_types
=
1
);
namespace
DoctrineMigrations
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\Migrations\AbstractMigration
;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final
class
Version20240302095543
extends
AbstractMigration
{
public
function
getDescription
()
:
string
{
return
''
;
}
public
function
up
(
Schema
$schema
)
:
void
{
// this up() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\''
);
$this
->
addSql
(
'ALTER TABLE user ADD before_first_login_with_presta_enabled TINYINT(1) DEFAULT \'1\' NOT NULL'
);
}
public
function
down
(
Schema
$schema
)
:
void
{
// this down() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\''
);
$this
->
addSql
(
'ALTER TABLE user DROP before_first_login_with_presta_enabled'
);
}
}
src/Twig/AppExtension.php
View file @
0491fb26
...
@@ -206,6 +206,23 @@ class AppExtension extends AbstractExtension
...
@@ -206,6 +206,23 @@ class AppExtension extends AbstractExtension
public
function
showModalGroupChoice
()
public
function
showModalGroupChoice
()
{
{
if
(
null
!=
$this
->
security
->
getUser
())
{
if
(
null
!=
$this
->
security
->
getUser
())
{
/* Enable display of modal after the first login of a user,
* the first time there is an enable prestataire associated to the account.
*
* The user now realizes that a new role is available and can be picked up.
*
* Otherwise, in case prestataire is enabled after first login, user would login automaticaly as
* adherent again without being noticed that prestataire has been enabled.
*/
if
(
$this
->
container
->
getParameter
(
'presta_self_init_and_eval'
))
{
$hasPrestataireEnabled
=
$this
->
security
->
getUser
()
->
getPrestataires
()
&&
!
$this
->
security
->
getUser
()
->
getPrestataires
()
->
isEmpty
();
$nowIsfirstLoginWithPrestaEnabled
=
$this
->
security
->
getUser
()
->
getBeforeFirstLoginWithPrestaEnabled
();
if
(
$hasPrestataireEnabled
&&
$nowIsfirstLoginWithPrestaEnabled
)
{
$this
->
security
->
getUser
()
->
setBeforeFirstLoginWithPrestaEnabled
(
false
);
$this
->
em
->
flush
();
return
true
;
}
}
if
(
count
(
$this
->
security
->
getUser
()
->
getPossiblegroups
())
>
1
&&
0
==
count
(
$this
->
security
->
getUser
()
->
getGroups
()))
{
if
(
count
(
$this
->
security
->
getUser
()
->
getPossiblegroups
())
>
1
&&
0
==
count
(
$this
->
security
->
getUser
()
->
getGroups
()))
{
return
true
;
return
true
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment