All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ebiznext.comet.schema.model.RowLevelSecurity.scala Maven / Gradle / Ivy

There is a newer version: 0.2.6
Show newest version
package com.ebiznext.comet.schema.model

case class RowLevelSecurity(
  name: String,
  predicate: String,
  grants: List[String]
) {

  def grantees(): List[(UserType, String)] = {
    grants.map { user =>
      val res = user.split(':')
      assert(res.length == 2)
      (UserType.fromString(res(0).trim), res(1).trim)
    }

  }
}

object RowLevelSecurity {

  def parse(input: String): RowLevelSecurity = {
    val components = input.split(',')
    assert(components.length >= 3)
    val name = components(0)
    val filter = components(1)
    val users = components.drop(2)
    RowLevelSecurity(name, filter, users.toList)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy