mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-01-06 13:56:14 +08:00
don't into roles too early
Signed-off-by: MiniDigger <admin@minidigger.me>
This commit is contained in:
parent
890b6ffbfc
commit
14affc63f1
@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class RoleService {
|
||||
@ -48,19 +49,23 @@ public class RoleService {
|
||||
this.userOrganizationRolesDao = userOrganizationRolesDao;
|
||||
this.organizationMembersDao = organizationMembersDao;
|
||||
this.orgService = orgService;
|
||||
init();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
RolesTable admin = roleDao.get().getById(1);
|
||||
if (admin != null && admin.getRole() == Role.HANGAR_ADMIN) {
|
||||
log.info("Skipping role init");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
RolesTable admin = roleDao.get().getById(1);
|
||||
if (admin != null && admin.getRole() == Role.HANGAR_ADMIN) {
|
||||
log.info("Skipping role init");
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("Initializing roles (first start only)");
|
||||
for (Role role : Role.values()) {
|
||||
roleDao.get().insert(RolesTable.fromRole(role));
|
||||
log.info("Initializing roles (first start only)");
|
||||
for (Role role : Role.values()) {
|
||||
roleDao.get().insert(RolesTable.fromRole(role));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.warn("Error while role initialization!", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user