Skip to content

Commit

Permalink
Merge branch 'master' of git.uibk.ac.at:csar8683/freebim
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklanzinger committed May 12, 2020
2 parents ffac78c + fa9ab20 commit 522df1d
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*****************************************************************************/
package at.freebim.db.service;

import org.springframework.security.access.annotation.Secured;

import at.freebim.db.domain.SearchStringNode;

/**
Expand All @@ -33,13 +35,15 @@ public interface SearchStringNodeService extends BaseNodeService<SearchStringNod
*
* @see at.freebim.db.service.BaseService#save(java.lang.Object)
*/
@Secured({ "ROLE_EDIT", "ROLE_ADMIN", "ROLE_GUEST" })
SearchStringNode save(SearchStringNode node);

/*
* (non-Javadoc)
*
* @see at.freebim.db.service.BaseService#delete(java.lang.Object)
*/
@Secured({ "ROLE_EDIT", "ROLE_ADMIN", "ROLE_GUEST" })
SearchStringNode delete(SearchStringNode node);

}
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public ArrayList<RelationResult> getAllRelatedInOut(Long nodeId) {

if (user.getRoles().contains(Role.ROLE_GUEST)) {
b.append("MATCH (n) WHERE ID(n)={id}");
b.append(" AND (\"StatedBaseNode\" in labels(n) and (n.status = \"CHECKED\" or ");
b.append(" AND (\"StatedBaseNode\" in labels(n) and (n.state IN ['CHECKED', 'IMPORTED', 'RELEASED', 'UNDEFINED'] or ");
b.append("(\"BigBangNode\" in labels(n) or \"Library\" in labels(n))))");

b.append(" OPTIONAL MATCH (n)<-[relIn]-(a) WHERE");
Expand All @@ -526,7 +526,7 @@ public ArrayList<RelationResult> getAllRelatedInOut(Long nodeId) {
b.append(RelationType.BELONGS_TO);
b.append("\"");

b.append(" AND (\"StatedBaseNode\" in labels(a) and (a.status = \"CHECKED\" or ");
b.append(" AND (\"StatedBaseNode\" in labels(a) and (a.state IN ['CHECKED', 'IMPORTED', 'RELEASED', 'UNDEFINED'] or ");
b.append("(\"BigBangNode\" in labels(a) or \"Library\" in labels(a))))");

b.append(" OPTIONAL MATCH (n)-[relOut]->(b) WHERE");
Expand All @@ -545,7 +545,7 @@ public ArrayList<RelationResult> getAllRelatedInOut(Long nodeId) {
b.append(" type(relOut) <> \"");
b.append(RelationType.BELONGS_TO);
b.append("\"");
b.append(" AND (\"StatedBaseNode\" in labels(b) and (b.status = \"CHECKED\" or ");
b.append(" AND (\"StatedBaseNode\" in labels(b) and (b.state IN ['CHECKED', 'IMPORTED', 'RELEASED', 'UNDEFINED'] or ");
b.append("(\"BigBangNode\" in labels(b) or \"Library\" in labels(b))))");
b.append(" RETURN distinct n, a, b, relIn, relOut, relIn.ts AS t1, relOut.ts AS t2");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,21 @@ public T filterResponse(T node, Long now) {
user = this.freebimUserService.get(auth.getName());

if (user != null) {
if (user.getRoles().contains(Role.ROLE_GUEST) && node instanceof StatedBaseNode
&& node.getState() != State.CHECKED && !(node instanceof BigBangNode)
if (user.getRoles().contains(Role.ROLE_GUEST)
&& node instanceof StatedBaseNode
&& !(node instanceof BigBangNode)
&& !(node instanceof Library)) {
return super.filterResponse(null, now);
} else {
return super.filterResponse(node, now);
switch (node.getState()) {
case CHECKED:
case IMPORTED:
case RELEASED:
case UNDEFINED:
break;
case REJECTED:
case TODELETE:
default:
return super.filterResponse(null, now);
}
}
}

Expand All @@ -184,22 +193,20 @@ public ArrayList<Long> getAllRelevantNodeIds() {

Authentication auth = SecurityContextHolder.getContext().getAuthentication();

boolean permissionRequired = false;
// permission required
FreebimUser user = null;
if (auth != null) {
logger.debug("auth.name=[{}]", auth.getName());
user = this.freebimUserService.get(auth.getName());

if (user != null) {
if (user.getRoles().contains(Role.ROLE_GUEST)) {
getRelevantQuery(b,
"AND (y.state = \"CHECKED\" or (\"BigBangNode\" in labels(y) or \"Library\" in labels(y))) RETURN DISTINCT ID(y) AS id");
} else {
getRelevantQuery(b, " RETURN DISTINCT ID(y) AS id");
permissionRequired = true;
}
} else {
getRelevantQuery(b, " RETURN DISTINCT ID(y) AS id");
}
}
if (permissionRequired) {
getRelevantQuery(b, "AND (y.state IN ['CHECKED', 'IMPORTED', 'RELEASED', 'UNDEFINED'] or ('BigBangNode' in labels(y) or 'Library' in labels(y))) RETURN DISTINCT ID(y) AS id");
} else {
getRelevantQuery(b, " RETURN DISTINCT ID(y) AS id");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,8 @@
${appBuildTime}</span><br /> <a href="http://www.freebim.at/?info"
i18n_href="APP_FREEBIM_LINK" target="_blank" title="freeBIM-Tirol">www.freebim.at</a>
</p>
<c:if test="${username != null && username.length() > 0 && !username.equals('anonymousUser')}">
<p class="info"><span i18n="INFO_BIB"></span></p>
<p class="info"><span i18n="INFO_STATE"></span></p>
</c:if>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ input[type="radio"] {
}

.freebim-item.path, .freebim-path-rel {
float: left;
/* float: left; */
height: 12px;
}

Expand Down Expand Up @@ -1177,4 +1177,13 @@ div.freebim-MessageDlg p.message.warning {

#login_error_box {
display: none;
}
p.info {
max-width: 50%;
margin: 12px auto;
border: solid 1px lightgray;
padding: 4px;
border-radius: 4px;
box-shadow: 2px 1px lightgrey;
background-color: antiquewhite;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5723,7 +5723,7 @@ at.freebim.db.domain.Parameter = {
+ "type" + self.table.csvDelim
+ "status" + self.table.csvDelim;
self.table.cols = [
d.columns.code,
// d.columns.code,
{
label: "NAME",
field: nf.NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,12 @@ at.freebim.db.tree = {
field : rf.ORDERING,
type : "text",
sort : true
}, {
}/*, {
label : "CODE",
field : nf.CODE,
type : "text",
sort : true
},
}*/,
{
label : "NAME",
field : "name",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"INFO_BIB" : "Der Merkmalserver verwaltet Inhalte aus unterschiedlichen Quellen, die in sog. 'Bibliotheken' gegliedert sind. Für die ÖNORM sind nur Inhalte der Bibliotheken 'ÖNORM A6241-1' und 'ÖNORM A6241-2' relevant.",
"INFO_STATE" : "Inhalte, deren Status nicht 'geprüft' (grün) ist, sind nicht Teil der ÖNORM.",
"ALL_COMPONENTS": "alle Komponenten",
"APP_FREEBIM_LINK": "http://www.freebim.at/?info",
"APP_VERSION": "Version:",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"INFO_BIB" : "Der Merkmalserver verwaltet Inhalte aus unterschiedlichen Quellen, die in sog. 'Bibliotheken' gegliedert sind. Für die ÖNORM sind nur Inhalte der Bibliotheken 'ÖNORM A6241-1' und 'ÖNORM A6241-2' relevant.",
"INFO_STATE" : "Inhalte, deren Status nicht 'geprüft' (grün) ist, sind nicht Teil der ÖNORM.",
"ALL_COMPONENTS": "all Components",
"APP_FREEBIM_LINK": "http://www.freebim.at/?info",
"APP_VERSION": "Version:",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"INFO_BIB" : "Der Merkmalserver verwaltet Inhalte aus unterschiedlichen Quellen, die in sog. 'Bibliotheken' gegliedert sind. Für die ÖNORM sind nur Inhalte der Bibliotheken 'ÖNORM A6241-1' und 'ÖNORM A6241-2' relevant.",
"INFO_STATE" : "Inhalte, deren Status nicht 'geprüft' (grün) ist, sind nicht Teil der ÖNORM.",
"ALL_COMPONENTS": "todos los componentes",
"APP_FREEBIM_LINK": "http://www.freebim.at/?info",
"APP_VERSION": "Versión:",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"INFO_BIB" : "Der Merkmalserver verwaltet Inhalte aus unterschiedlichen Quellen, die in sog. 'Bibliotheken' gegliedert sind. Für die ÖNORM sind nur Inhalte der Bibliotheken 'ÖNORM A6241-1' und 'ÖNORM A6241-2' relevant.",
"INFO_STATE" : "Inhalte, deren Status nicht 'geprüft' (grün) ist, sind nicht Teil der ÖNORM.",
"ALL_COMPONENTS": "tous les composants",
"APP_FREEBIM_LINK": "http://www.freebim.at/?info",
"APP_VERSION": "Version:",
Expand Down

0 comments on commit 522df1d

Please sign in to comment.