mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
fix: properly block org transfers
This commit is contained in:
parent
aff7104562
commit
5d4a526a92
@ -65,10 +65,13 @@ public abstract class InviteService<LC extends LogContext<?, LC>, R extends Role
|
||||
@Transactional
|
||||
public void sendTransferRequest(final String user, final J joinable) {
|
||||
final UserTable userTable = this.userDAO.getUserTable(user);
|
||||
// TODO transfer project to organization (and divert invite to owner)
|
||||
if (userTable == null || userTable.isOrganization()) {
|
||||
if (userTable == null) {
|
||||
throw new HangarApiException(this.errorPrefix + "invalidUser", user);
|
||||
}
|
||||
// TODO transfer project to organization (and divert invite to owner)
|
||||
if (userTable.getEmail().endsWith(this.config.org.dummyEmailDomain())) {
|
||||
throw new HangarApiException("Org transfers are not implemented yet");
|
||||
}
|
||||
|
||||
final List<RT> ownerRoles = this.roleService.getRoles(joinable.getId(), this.getOwnerRole());
|
||||
if (ownerRoles.stream().anyMatch(rt -> rt.getUserId() != joinable.getOwnerId())) {
|
||||
|
Loading…
Reference in New Issue
Block a user