diff options
author | vlad <vlad@driver.xyz> | 2017-01-20 14:09:04 -0800 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-01-20 14:09:04 -0800 |
commit | e24135e5c64798d9eaf57c2bad0b678cbaef6be5 (patch) | |
tree | 035a0e9f2a22b1f7467ee2774b336c1c98379bcd /src/main/scala/xyz | |
parent | 1ead2cc958a285fd2be9cb4b0c60470a5f95818a (diff) | |
download | driver-core-0.9.33.tar.gz driver-core-0.9.33.tar.bz2 driver-core-0.9.33.zip |
Role.fromStringv0.9.33
Diffstat (limited to 'src/main/scala/xyz')
-rw-r--r-- | src/main/scala/xyz/driver/core/auth.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/auth.scala b/src/main/scala/xyz/driver/core/auth.scala index 0b30bc0..cede122 100644 --- a/src/main/scala/xyz/driver/core/auth.scala +++ b/src/main/scala/xyz/driver/core/auth.scala @@ -31,6 +31,19 @@ object auth { def hasPermission(permission: Permission): Boolean = permissions.contains(permission) } + object Role { + def fromString(roleString: String): Option[Role] = roleString match { + case "Observer" => Some(ObserverRole) + case "Patient" => Some(PatientRole) + case "Curator" => Some(CuratorRole) + case "Pathologist" => Some(PathologistRole) + case "Administrator" => Some(AdministratorRole) + case "Physician" => Some(PhysicianRole) + case "Relative" => Some(RelativeRole) + case _ => None + } + } + case object ObserverRole extends Role { val id = Id("1") val name = Name("observer") |