mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-03-19 15:40:50 +08:00
'Fix' org creation on fakeuser setup
This commit is contained in:
parent
dbc536b7e5
commit
bea83c9b1f
@ -7,6 +7,7 @@ import io.papermc.hangar.db.dao.HangarDao;
|
||||
import io.papermc.hangar.db.dao.OrganizationDao;
|
||||
import io.papermc.hangar.db.dao.UserDao;
|
||||
import io.papermc.hangar.db.model.OrganizationsTable;
|
||||
import io.papermc.hangar.db.model.UsersTable;
|
||||
import io.papermc.hangar.model.NotificationType;
|
||||
import io.papermc.hangar.model.Role;
|
||||
import io.papermc.hangar.model.viewhelpers.UserData;
|
||||
@ -21,6 +22,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@ -69,7 +71,9 @@ public class OrgFactory {
|
||||
}
|
||||
} else {
|
||||
authOrgUser = new AuthUser(-100, name, dummyEmail, "", Locale.ENGLISH, null);
|
||||
userDao.get().insert(new UsersTable(authOrgUser.getId(), null, name, dummyEmail, null, List.of(), false, authOrgUser.getLang().toLanguageTag()));
|
||||
}
|
||||
|
||||
// Just a note, the /api/sync_sso creates the org user here, so it will already be created when the above response is returned
|
||||
OrganizationsTable org = new OrganizationsTable(name, ownerId, authOrgUser.getId());
|
||||
org = organizationDao.get().insert(org);
|
||||
|
@ -66,10 +66,7 @@ public class RoleService {
|
||||
}
|
||||
|
||||
public void addRole(ProjectsTable projectsTable, long userId, Role role, boolean isAccepted) {
|
||||
boolean exists = userProjectRolesDao.get().getByProjectAndUser(projectsTable.getId(), userId) != null;
|
||||
System.out.println(exists);
|
||||
if (!exists) {
|
||||
System.out.println("add member");
|
||||
if (userProjectRolesDao.get().getByProjectAndUser(projectsTable.getId(), userId) == null) {
|
||||
addMember(projectsTable.getId(), userId);
|
||||
}
|
||||
userProjectRolesDao.get().insert(new UserProjectRolesTable(userId, role.getValue(), projectsTable.getId(), isAccepted));
|
||||
|
Loading…
x
Reference in New Issue
Block a user