PostgreSQLPermissionRepositoryImpl

works.iterative.sqldb.postgresql.PostgreSQLPermissionRepositoryImpl
case class PostgreSQLPermissionRepositoryImpl(ts: PostgreSQLTransactor) extends PermissionRepository

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait PermissionRepository
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def addRelation(userId: UserId, relation: String, target: PermissionTarget): Task[Unit]

Add a relation tuple to the database.

Add a relation tuple to the database.

This operation should be idempotent - adding the same relation twice should succeed without error (either by using INSERT IGNORE or catching unique constraint violations).

Value parameters

relation

The relationship type

target

The permission target

userId

The user ID

Attributes

Returns

Task[Unit]

Definition Classes
PermissionRepository
override def getUserRelations(userId: UserId, namespace: String): Task[Set[RelationTuple]]

Get all relation tuples for a user in a specific namespace.

Get all relation tuples for a user in a specific namespace.

This is the primary query for permission checking - fetches all relations the user has within a namespace, which are then evaluated by PermissionLogic.

Value parameters

namespace

The resource namespace to filter by

userId

The user ID

Attributes

Returns

Task[Set[RelationTuple]] - Set of all relation tuples for the user in namespace

Definition Classes
PermissionRepository
override def hasRelation(userId: UserId, relation: String, target: PermissionTarget): Task[Boolean]

Check if a specific relation exists between user and target.

Check if a specific relation exists between user and target.

Value parameters

relation

The relationship type (e.g., "owner", "editor", "viewer")

target

The permission target

userId

The user ID to check

Attributes

Returns

Task[Boolean] - true if relation exists, false otherwise

Definition Classes
PermissionRepository
override def removeRelation(userId: UserId, relation: String, target: PermissionTarget): Task[Unit]

Remove a relation tuple from the database.

Remove a relation tuple from the database.

This operation should be idempotent - removing a non-existent relation should succeed.

Value parameters

relation

The relationship type

target

The permission target

userId

The user ID

Attributes

Returns

Task[Unit]

Definition Classes
PermissionRepository

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product