Skip to content

Commit

Permalink
Fix BME_NEWBIE unit scope change
Browse files Browse the repository at this point in the history
  • Loading branch information
set committed Sep 5, 2023
1 parent fa40404 commit f05742d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/hu/gerviba/authsch/struct/BMEUnitScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
public enum BMEUnitScope {
BME (true, false, false, false, false),
BME_NEWBIE (true, false, false, true , false),
BME_VIK (true, true, false, false, false),
BME_ACTIVE (true, false, true, false, false),
BME_VIK_ACTIVE(true, true, true, false, false),
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/hu/gerviba/authsch/struct/Scope.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.fasterxml.jackson.databind.JsonNode;

import hu.gerviba.authsch.response.ProfileDataResponse.ProfileDataResponseBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Access Scope
Expand Down Expand Up @@ -187,10 +189,18 @@ public void apply(ProfileDataResponseBuilder response, JsonNode obj) {
@Override
public void apply(ProfileDataResponseBuilder response, JsonNode obj) {
obj.path(Scope.BME_UNIT_SCOPE.getScope()).elements()
.forEachRemaining(x -> response.addBmeUnitScope(BMEUnitScope.valueOf(x.asText())));
.forEachRemaining(x -> {
try {
response.addBmeUnitScope(BMEUnitScope.valueOf(x.asText()));
} catch (IllegalArgumentException e) {
log.error("Invalid BMEUnitScope literal {}", x.asText(), e);
}
});
}
};

private static final Logger log = LoggerFactory.getLogger(Scope.class);

private final String scope;

private Scope(String scope) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/hu/kirdev/schpincer/web/LoginController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ open class LoginController {
return false
if (user.forceGrantLoginAccess)
return false
if (profile.eduPersonEntitlements.size > 0)
if (profile.eduPersonEntitlements.isNotEmpty())
return false

return true
Expand Down
8 changes: 6 additions & 2 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ <h3 th:text="#{lang.orders.active}">Aktív rendelések</h3>
</div>
</div>

<object th:remove="tag" th:if="${T(java.lang.System).currentTimeMillis() gt 1639090800000L}">
<object th:remove="tag">
<div th:replace="news/news_2023_09_06 :: article"></div>
</object>

<object th:remove="all">
<div th:replace="news/news_2021_12_10 :: article"></div>
</object>
<object th:remove="tag" th:if="${T(java.lang.System).currentTimeMillis() lt 1639090800000L}">
<object th:remove="all">
<div th:replace="news/news_2021_10_14 :: article"></div>
</object>

Expand Down
35 changes: 35 additions & 0 deletions src/main/resources/templates/news/news_2023_09_06.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<html xmlns:th="http://www.thymeleaf.org/">
<body>
<div th:fragment="article" th:remove="tag">

<div class="article news-article">
<div class="svg-header">
<div class="news">
<i class="material-icons">calendar_today</i>
<span>09.06.</span>
</div>
</div>

<h3>Mi leszünk végig</h3>

<p>
Mindegy milyen rég óta vagy már fiatal, ha megéheztél, jó helyen jársz! A kajás körök nyitásai visszatértek!
</p>

<p>
Szeretnél többet megtudni, vagy szívesen bekapcsolódnál a fejlesztésbe?
</p>

<ul>
<li><a href="https://github.com/orgs/kir-dev/projects/5"><i class="material-icons">link</i> Projekt állása</a></li>
<li><a href="https://github.com/kir-dev/sch-pincer"><i class="material-icons">link</i> Besegítenék</a></li>
<li>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSe1XaJuDzGjPUWvSnud8XXsEgUCUOUGsCHeoud_AgVJb6qorA/viewform?usp=sf_link"><i
class="material-icons">link</i> Vannak ötleteim/visszajelzésem</a>
</li>
</ul>
</div>

</div>
</body>
</html>

0 comments on commit f05742d

Please sign in to comment.