Skip to content

Commit

Permalink
Merge pull request #3101 from Vojtech-Sassmann/fixSponPasswd
Browse files Browse the repository at this point in the history
Core - generate password for sponsored user
  • Loading branch information
zlamalp committed Feb 22, 2021
1 parent e1ea4c7 commit b06e163
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,8 @@ public interface MembersManager {
* @param vo virtual organization for the member
* @param namespace namespace for selecting password module
* @param name a map containing the full name or its parts (mandatory: firstName, lastName; optionally: titleBefore, titleAfter)
* @param password password
* @param password password, if the password is empty, and the `sendActivationLink` is set to true, this method will
* generate a random password for the created user
* @param email (optional) preferred email that will be set to the created user. If no email
* is provided, "[email protected]" is used.
* @param sponsor sponsoring user or null for the caller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,8 @@ public interface MembersManagerBl {
* @param vo virtual organization
* @param namespace used for selecting external system in which guest user account will be created
* @param name a map containing the full name or its parts (mandatory: firstName, lastName; optionally: titleBefore, titleAfter)
* @param password password
* @param password password, if the password is empty, and the `sendActivationLink` is set to true, this method will
* generate a random password for the created user
* @param email (optional) preferred email that will be set to the created user. If no email
* is provided, "[email protected]" is used.
* @param sponsor sponsoring user
Expand Down Expand Up @@ -1474,7 +1475,8 @@ public interface MembersManagerBl {
* @param vo virtual organization
* @param namespace used for selecting external system in which guest user account will be created
* @param name a map containing the full name or its parts (mandatory: firstName, lastName; optionally: titleBefore, titleAfter)
* @param password password
* @param password password, if the password is empty, and the `sendActivationLink` is set to true, this method will
* generate a random password for the created user
* @param email (optional) preferred email that will be set to the created user. If no email
* is provided, "[email protected]" is used.
* @param sponsor sponsoring user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,11 @@ public Member createSponsoredMember(PerunSession session, Vo vo, String namespac
}
}

if (password.isBlank() && sendActivationLink) {
var module = getPerunBl().getUsersManagerBl().getPasswordManagerModule(session, namespace);
password = module.generateRandomPassword(session, null);
}

Member sponsoredMember = setSponsoredMember(session, vo, sponsoredUser, namespace, password, sponsor, validityTo, validation);

//try to send activation link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public Member call(ApiCaller ac, Deserializer parms) throws PerunException {
* @param lastName last name - mandatory
* @param titleBefore titles before the name - optionally
* @param titleAfter titles after the name - optionally
* @param password String password
* @param password String password, if the password is empty, and the `sendActivationLink` is set to true, this method will
* generate a random password for the created user
* @param vo int VO ID
* @param namespace String namespace selecting remote system for storing the password
* @param sponsor int sponsor's ID
Expand Down

0 comments on commit b06e163

Please sign in to comment.