From 9618eb7f1dcddf1bb422e98d6c20976dfe7e7aa2 Mon Sep 17 00:00:00 2001 From: nk-coding Date: Mon, 9 Sep 2024 14:34:50 +0200 Subject: [PATCH] add missing permissions --- .../architecture/layout/RelationLayout.kt | 21 +++++++++++++++---- .../layout/RelationPartnerLayout.kt | 21 +++++++++++++++---- .../gropius/model/architecture/layout/View.kt | 10 +++++---- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/core/src/main/kotlin/gropius/model/architecture/layout/RelationLayout.kt b/core/src/main/kotlin/gropius/model/architecture/layout/RelationLayout.kt index d4e2b5f4..80337b3b 100644 --- a/core/src/main/kotlin/gropius/model/architecture/layout/RelationLayout.kt +++ b/core/src/main/kotlin/gropius/model/architecture/layout/RelationLayout.kt @@ -2,15 +2,18 @@ package gropius.model.architecture.layout import com.expediagroup.graphql.generator.annotations.GraphQLDescription import com.expediagroup.graphql.generator.annotations.GraphQLIgnore +import gropius.model.architecture.Project import gropius.model.architecture.Relation import gropius.model.common.BaseNode -import io.github.graphglue.model.Direction -import io.github.graphglue.model.DomainNode -import io.github.graphglue.model.FilterProperty -import io.github.graphglue.model.NodeRelationship +import gropius.model.user.permission.NodePermission +import io.github.graphglue.model.* @DomainNode @GraphQLDescription("Layout for a Relation") +@Authorization( + NodePermission.READ, + allowFromRelated = ["project", "view"] +) class RelationLayout( @property:GraphQLIgnore var xCoordinates: IntArray, @@ -23,6 +26,16 @@ class RelationLayout( @FilterProperty val relation by NodeProperty() + @NodeRelationship(Project.RELATION, Direction.OUTGOING) + @GraphQLDescription("The project this layout is for, mutually exclusive with view.") + @FilterProperty + val project by NodeProperty() + + @NodeRelationship(View.RELATION, Direction.OUTGOING) + @GraphQLDescription("The view this layout is for, mutually exclusive with project.") + @FilterProperty + val view by NodeProperty() + @GraphQLDescription("The intermediate points of the Relation in the layout.") val points get() = xCoordinates.zip(yCoordinates).map { Point(it.first, it.second) } diff --git a/core/src/main/kotlin/gropius/model/architecture/layout/RelationPartnerLayout.kt b/core/src/main/kotlin/gropius/model/architecture/layout/RelationPartnerLayout.kt index 27c5c6aa..786e3e35 100644 --- a/core/src/main/kotlin/gropius/model/architecture/layout/RelationPartnerLayout.kt +++ b/core/src/main/kotlin/gropius/model/architecture/layout/RelationPartnerLayout.kt @@ -2,15 +2,18 @@ package gropius.model.architecture.layout import com.expediagroup.graphql.generator.annotations.GraphQLDescription import com.expediagroup.graphql.generator.annotations.GraphQLIgnore +import gropius.model.architecture.Project import gropius.model.architecture.RelationPartner import gropius.model.common.BaseNode -import io.github.graphglue.model.Direction -import io.github.graphglue.model.DomainNode -import io.github.graphglue.model.FilterProperty -import io.github.graphglue.model.NodeRelationship +import gropius.model.user.permission.NodePermission +import io.github.graphglue.model.* @DomainNode @GraphQLDescription("Layout for a RelationPartner (ComponentVersion or Interface)") +@Authorization( + NodePermission.READ, + allowFromRelated = ["project", "view"] +) class RelationPartnerLayout( @property:GraphQLIgnore var x: Int, @@ -23,6 +26,16 @@ class RelationPartnerLayout( @FilterProperty val relationPartner by NodeProperty() + @NodeRelationship(Project.RELATION_PARTNER, Direction.OUTGOING) + @GraphQLDescription("The project this layout is for, mutually exclusive with view.") + @FilterProperty + val project by NodeProperty() + + @NodeRelationship(View.RELATION_PARTNER, Direction.OUTGOING) + @GraphQLDescription("The view this layout is for, mutually exclusive with project.") + @FilterProperty + val view by NodeProperty() + @GraphQLDescription("The position of the RelationPartner in the layout.") val pos get() = Point(x, y) diff --git a/core/src/main/kotlin/gropius/model/architecture/layout/View.kt b/core/src/main/kotlin/gropius/model/architecture/layout/View.kt index 1e3e81f2..7fd825fd 100644 --- a/core/src/main/kotlin/gropius/model/architecture/layout/View.kt +++ b/core/src/main/kotlin/gropius/model/architecture/layout/View.kt @@ -4,13 +4,15 @@ import com.expediagroup.graphql.generator.annotations.GraphQLDescription import gropius.model.architecture.Project import gropius.model.common.NamedNode import gropius.model.template.ComponentTemplate -import io.github.graphglue.model.Direction -import io.github.graphglue.model.DomainNode -import io.github.graphglue.model.FilterProperty -import io.github.graphglue.model.NodeRelationship +import gropius.model.user.permission.NodePermission +import io.github.graphglue.model.* @DomainNode(searchQueryName = "searchViews") @GraphQLDescription("A view on the architecture graph of a project") +@Authorization( + NodePermission.READ, + allowFromRelated = ["project"] +) class View( name: String, description: String ) : NamedNode(name, description), Layout {