Skip to content

Commit

Permalink
Merge pull request #129 from ccims/bugfix/missing_layout_permissions
Browse files Browse the repository at this point in the history
add missing permissions
  • Loading branch information
nk-coding authored Sep 9, 2024
2 parents 155fc9f + 9618eb7 commit 18f1071
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,6 +26,16 @@ class RelationLayout(
@FilterProperty
val relation by NodeProperty<Relation>()

@NodeRelationship(Project.RELATION, Direction.OUTGOING)
@GraphQLDescription("The project this layout is for, mutually exclusive with view.")
@FilterProperty
val project by NodeProperty<Project?>()

@NodeRelationship(View.RELATION, Direction.OUTGOING)
@GraphQLDescription("The view this layout is for, mutually exclusive with project.")
@FilterProperty
val view by NodeProperty<View?>()

@GraphQLDescription("The intermediate points of the Relation in the layout.")
val points get() = xCoordinates.zip(yCoordinates).map { Point(it.first, it.second) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,6 +26,16 @@ class RelationPartnerLayout(
@FilterProperty
val relationPartner by NodeProperty<RelationPartner>()

@NodeRelationship(Project.RELATION_PARTNER, Direction.OUTGOING)
@GraphQLDescription("The project this layout is for, mutually exclusive with view.")
@FilterProperty
val project by NodeProperty<Project?>()

@NodeRelationship(View.RELATION_PARTNER, Direction.OUTGOING)
@GraphQLDescription("The view this layout is for, mutually exclusive with project.")
@FilterProperty
val view by NodeProperty<View?>()

@GraphQLDescription("The position of the RelationPartner in the layout.")
val pos get() = Point(x, y)

Expand Down
10 changes: 6 additions & 4 deletions core/src/main/kotlin/gropius/model/architecture/layout/View.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 18f1071

Please sign in to comment.