Merge branch 'release' of https://github.com/appsmithorg/appsmith into release
This commit is contained in:
commit
38b9dfaa86
|
|
@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
|
|
@ -51,8 +52,10 @@ public class OrganizationController extends BaseController<OrganizationService,
|
|||
}
|
||||
|
||||
@PutMapping("/{orgId}/role")
|
||||
public Mono<ResponseDTO<UserRole>> updateRoleForMember(@RequestBody UserRole updatedUserRole, @PathVariable String orgId) {
|
||||
return userOrganizationService.updateRoleForMember(orgId, updatedUserRole)
|
||||
public Mono<ResponseDTO<UserRole>> updateRoleForMember(@RequestBody UserRole updatedUserRole,
|
||||
@PathVariable String orgId,
|
||||
@RequestHeader(name = "Origin", required = false) String originHeader) {
|
||||
return userOrganizationService.updateRoleForMember(orgId, updatedUserRole, originHeader)
|
||||
.map(user -> new ResponseDTO<>(HttpStatus.OK.value(), user, null));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public interface UserOrganizationService {
|
|||
|
||||
Mono<Organization> removeUserRoleFromOrganizationGivenUserObject(Organization organization, User user);
|
||||
|
||||
Mono<UserRole> updateRoleForMember(String orgId, UserRole userRole);
|
||||
Mono<UserRole> updateRoleForMember(String orgId, UserRole userRole, String originHeader);
|
||||
|
||||
Mono<Organization> bulkAddUsersToOrganization(Organization organization, List<User> users, String roleName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ public class UserOrganizationServiceImpl implements UserOrganizationService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Mono<UserRole> updateRoleForMember(String orgId, UserRole userRole) {
|
||||
public Mono<UserRole> updateRoleForMember(String orgId, UserRole userRole, String originHeader) {
|
||||
if (userRole.getUsername() == null) {
|
||||
return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "username"));
|
||||
}
|
||||
|
|
@ -293,8 +293,9 @@ public class UserOrganizationServiceImpl implements UserOrganizationService {
|
|||
Map<String, String> params = new HashMap<>();
|
||||
params.put("Inviter_First_Name", currentUser.getName());
|
||||
params.put("inviter_org_name", organization.getName());
|
||||
params.put("inviteUrl", originHeader);
|
||||
params.put("user_role_name", userRole.getRoleName());
|
||||
|
||||
|
||||
Mono<String> emailMono = emailSender.sendMail(user.getEmail(),
|
||||
"Appsmith: Your Role has been changed",
|
||||
UPDATE_ROLE_EXISTING_USER_TEMPLATE, params);
|
||||
|
|
|
|||
|
|
@ -726,7 +726,7 @@ public class OrganizationServiceTest {
|
|||
UserRole userRole = new UserRole();
|
||||
userRole.setUsername("usertest@usertest.com");
|
||||
userRole.setRoleName("App Viewer");
|
||||
return userOrganizationService.updateRoleForMember(org.getId(), userRole);
|
||||
return userOrganizationService.updateRoleForMember(org.getId(), userRole, "http://localhost:8080");
|
||||
});
|
||||
|
||||
Mono<Application> applicationAfterRoleChange = organizationMono
|
||||
|
|
@ -798,7 +798,7 @@ public class OrganizationServiceTest {
|
|||
userRole.setUsername("usertest@usertest.com");
|
||||
// Setting the role name to null ensures that user is deleted from the organization
|
||||
userRole.setRoleName(null);
|
||||
return userOrganizationService.updateRoleForMember(org.getId(), userRole);
|
||||
return userOrganizationService.updateRoleForMember(org.getId(), userRole, "http://localhost:8080");
|
||||
});
|
||||
|
||||
Mono<Tuple2<Application, Organization>> tupleMono = organizationMono
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user