Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
180b8c58
Commit
180b8c58
authored
4 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: more user properties variables in lifecycle management
parent
8aa04f97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/user/manager/lifecycle/UserLifecycleManagerImpl.java
+24
-4
24 additions, 4 deletions
...olat/user/manager/lifecycle/UserLifecycleManagerImpl.java
with
24 additions
and
4 deletions
src/main/java/org/olat/user/manager/lifecycle/UserLifecycleManagerImpl.java
+
24
−
4
View file @
180b8c58
...
...
@@ -45,6 +45,7 @@ import org.olat.core.CoreSpringFactory;
import
org.olat.core.commons.persistence.DB
;
import
org.olat.core.gui.translator.Translator
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.User
;
import
org.olat.core.id.UserConstants
;
import
org.olat.core.logging.Tracing
;
import
org.olat.core.util.Util
;
...
...
@@ -57,6 +58,7 @@ import org.olat.core.util.session.UserSessionManager;
import
org.olat.repository.RepositoryDeletionModule
;
import
org.olat.user.UserDataDeletable
;
import
org.olat.user.UserLifecycleManager
;
import
org.olat.user.UserManager
;
import
org.olat.user.UserModule
;
import
org.olat.user.ui.admin.lifecycle.UserAdminLifecycleConfigurationController
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -84,6 +86,8 @@ public class UserLifecycleManagerImpl implements UserLifecycleManager {
@Autowired
private
MailManager
mailManager
;
@Autowired
private
UserManager
userManager
;
@Autowired
private
BaseSecurity
securityManager
;
@Autowired
private
UserSessionManager
userSessionManager
;
...
...
@@ -331,7 +335,7 @@ public class UserLifecycleManagerImpl implements UserLifecycleManager {
String
subject
=
translator
.
translate
(
subjectI18nKey
);
String
body
=
translator
.
translate
(
bodyI18nKey
);
LifecycleMailTemplate
template
=
new
LifecycleMailTemplate
(
subject
,
body
);
LifecycleMailTemplate
template
=
new
LifecycleMailTemplate
(
subject
,
body
,
locale
);
sendUserEmailTo
(
identity
,
template
,
type
);
}
...
...
@@ -356,15 +360,31 @@ public class UserLifecycleManagerImpl implements UserLifecycleManager {
return
CalendarUtils
.
startOfDay
(
date
);
}
private
static
final
class
LifecycleMailTemplate
extends
MailTemplate
{
private
final
class
LifecycleMailTemplate
extends
MailTemplate
{
private
final
Locale
locale
;
public
LifecycleMailTemplate
(
String
subject
,
String
body
)
{
public
LifecycleMailTemplate
(
String
subject
,
String
body
,
Locale
locale
)
{
super
(
subject
,
body
,
null
);
this
.
locale
=
locale
;
}
@Override
public
void
putVariablesInMailContext
(
VelocityContext
vContext
,
Identity
recipient
)
{
//
if
(
recipient
!=
null
)
{
User
user
=
recipient
.
getUser
();
vContext
.
put
(
"firstname"
,
user
.
getProperty
(
UserConstants
.
FIRSTNAME
,
null
));
vContext
.
put
(
UserConstants
.
FIRSTNAME
,
user
.
getProperty
(
UserConstants
.
FIRSTNAME
,
null
));
vContext
.
put
(
"lastname"
,
user
.
getProperty
(
UserConstants
.
LASTNAME
,
null
));
vContext
.
put
(
UserConstants
.
LASTNAME
,
user
.
getProperty
(
UserConstants
.
LASTNAME
,
null
));
String
fullName
=
userManager
.
getUserDisplayName
(
recipient
);
vContext
.
put
(
"fullname"
,
fullName
);
vContext
.
put
(
"fullName"
,
fullName
);
vContext
.
put
(
"mail"
,
userManager
.
getUserDisplayEmail
(
user
,
locale
));
vContext
.
put
(
"email"
,
userManager
.
getUserDisplayEmail
(
user
,
locale
));
vContext
.
put
(
"username"
,
recipient
.
getName
());
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment