diff --git a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala index 82bfcb9..85124f0 100644 --- a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala +++ b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala @@ -1,4 +1,5 @@ package works.iterative.core +import auth.UserId /** A simple object to hold unique user identification together with "humane" * identification Usually we need to display the user's name in the UI, which diff --git a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala index 82bfcb9..85124f0 100644 --- a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala +++ b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala @@ -1,4 +1,5 @@ package works.iterative.core +import auth.UserId /** A simple object to hold unique user identification together with "humane" * identification Usually we need to display the user's name in the UI, which diff --git a/core/shared/src/main/scala/works/iterative/core/UserId.scala b/core/shared/src/main/scala/works/iterative/core/UserId.scala deleted file mode 100644 index e82c89f..0000000 --- a/core/shared/src/main/scala/works/iterative/core/UserId.scala +++ /dev/null @@ -1,13 +0,0 @@ -package works.iterative.core - -// Unique identifier of the user -opaque type UserId = String - -object UserId: - def apply(value: String): Validated[UserId] = - // Validate that the value is not empty - Validated.nonEmptyString("user.id")(value) - - def unsafe(value: String): UserId = value - - extension (u: UserId) def value: String = u diff --git a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala index 82bfcb9..85124f0 100644 --- a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala +++ b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala @@ -1,4 +1,5 @@ package works.iterative.core +import auth.UserId /** A simple object to hold unique user identification together with "humane" * identification Usually we need to display the user's name in the UI, which diff --git a/core/shared/src/main/scala/works/iterative/core/UserId.scala b/core/shared/src/main/scala/works/iterative/core/UserId.scala deleted file mode 100644 index e82c89f..0000000 --- a/core/shared/src/main/scala/works/iterative/core/UserId.scala +++ /dev/null @@ -1,13 +0,0 @@ -package works.iterative.core - -// Unique identifier of the user -opaque type UserId = String - -object UserId: - def apply(value: String): Validated[UserId] = - // Validate that the value is not empty - Validated.nonEmptyString("user.id")(value) - - def unsafe(value: String): UserId = value - - extension (u: UserId) def value: String = u diff --git a/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala b/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala index 6a5c831..6edb8e4 100644 --- a/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala +++ b/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala @@ -13,7 +13,7 @@ def apply(namespace: String, id: String): PermissionTarget = require( namespace.trim.nonEmpty && id.trim.nonEmpty, - "Both namespece and id must be defined" + "Both namespace and id must be defined" ) require( namespace.indexOf(':') == -1 && id.indexOf(':') == -1, diff --git a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala index 82bfcb9..85124f0 100644 --- a/core/shared/src/main/scala/works/iterative/core/UserHandle.scala +++ b/core/shared/src/main/scala/works/iterative/core/UserHandle.scala @@ -1,4 +1,5 @@ package works.iterative.core +import auth.UserId /** A simple object to hold unique user identification together with "humane" * identification Usually we need to display the user's name in the UI, which diff --git a/core/shared/src/main/scala/works/iterative/core/UserId.scala b/core/shared/src/main/scala/works/iterative/core/UserId.scala deleted file mode 100644 index e82c89f..0000000 --- a/core/shared/src/main/scala/works/iterative/core/UserId.scala +++ /dev/null @@ -1,13 +0,0 @@ -package works.iterative.core - -// Unique identifier of the user -opaque type UserId = String - -object UserId: - def apply(value: String): Validated[UserId] = - // Validate that the value is not empty - Validated.nonEmptyString("user.id")(value) - - def unsafe(value: String): UserId = value - - extension (u: UserId) def value: String = u diff --git a/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala b/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala index 6a5c831..6edb8e4 100644 --- a/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala +++ b/core/shared/src/main/scala/works/iterative/core/auth/PermissionService.scala @@ -13,7 +13,7 @@ def apply(namespace: String, id: String): PermissionTarget = require( namespace.trim.nonEmpty && id.trim.nonEmpty, - "Both namespece and id must be defined" + "Both namespace and id must be defined" ) require( namespace.indexOf(':') == -1 && id.indexOf(':') == -1, diff --git a/core/shared/src/main/scala/works/iterative/core/auth/UserId.scala b/core/shared/src/main/scala/works/iterative/core/auth/UserId.scala index ceac729..2a2c200 100644 --- a/core/shared/src/main/scala/works/iterative/core/auth/UserId.scala +++ b/core/shared/src/main/scala/works/iterative/core/auth/UserId.scala @@ -1,9 +1,15 @@ package works.iterative.core.auth -/** Opaque type to distinguish user identifiers */ +import works.iterative.core.Validated + +// Unique identifier of the user opaque type UserId = String object UserId: - def apply(value: String): UserId = value + def apply(value: String): Validated[UserId] = + // Validate that the value is not empty + Validated.nonEmptyString("user.id")(value) - extension (userId: UserId) def value: String = userId + def unsafe(value: String): UserId = value + + extension (u: UserId) def value: String = u