-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
12 changed files
with
295 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...la/org/knora/webapi/slice/admin/domain/service/DefaultObjectAccessPermissionService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright © 2021 - 2024 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.knora.webapi.slice.admin.domain.service | ||
import zio.Chunk | ||
import zio.Task | ||
import zio.ZLayer | ||
|
||
import org.knora.webapi.slice.admin.domain.model.DefaultObjectAccessPermission | ||
import org.knora.webapi.slice.admin.domain.model.DefaultObjectAccessPermission.DefaultObjectAccessPermissionPart | ||
import org.knora.webapi.slice.admin.domain.model.DefaultObjectAccessPermission.ForWhat | ||
import org.knora.webapi.slice.admin.domain.model.DefaultObjectAccessPermissionRepo | ||
import org.knora.webapi.slice.admin.domain.model.KnoraProject | ||
import org.knora.webapi.slice.admin.domain.model.KnoraProject.ProjectIri | ||
import org.knora.webapi.slice.admin.domain.model.PermissionIri | ||
|
||
final case class DefaultObjectAccessPermissionService( | ||
private val repo: DefaultObjectAccessPermissionRepo, | ||
) { | ||
def findByProject(projectIri: ProjectIri): Task[Chunk[DefaultObjectAccessPermission]] = | ||
repo.findByProject(projectIri) | ||
|
||
def create( | ||
project: KnoraProject, | ||
forWhat: ForWhat, | ||
permission: Chunk[DefaultObjectAccessPermissionPart], | ||
): Task[DefaultObjectAccessPermission] = | ||
repo.save(DefaultObjectAccessPermission(PermissionIri.makeNew(project.shortcode), project.id, forWhat, permission)) | ||
} | ||
|
||
object DefaultObjectAccessPermissionService { | ||
val layer = ZLayer.derive[DefaultObjectAccessPermissionService] | ||
} |
Oops, something went wrong.