Awesome Open Source
Awesome Open Source

Cerberus

Yarn

Build Status

Lightweight Role and Attribute based Access Control for Scala.

Easy to use DSL for assigning permissions to different roles.

Read more about RBAC and ABAC.

Installation

resolvers += Resolver.bintrayRepo("jyotman","maven")

libraryDependencies += "xyz.jyotman" %% "cerberus" % "0.0.5"

Basic Example

import xyz.Types.Data
import xyz.jyotman.Cerberus
import xyz.jyotman.Dsl._
    
val data: Data = 
    ("user" can (
      ("read" any "project" attributes "title" & "description" & "!createdOn") also
        ("read" own "project" attributes "title" & "description") also
        ("create" own "project") also
        ("update" own "profile")       
      )) and
      ("curator" can (
        ("read" any "project") also
          ("update" any "project") also
          ("delete" any "project")
      ))
    
val cerberus = Cerberus(data)

cerberus.can("user", "create", "project").any // false
cerberus.can("user", "create", "project").own // true
cerberus.can("user", "read", "project").any(List("createdOn")) // false
cerberus.can("user", "read", "project").any(List("title", "description")) // true

Documentation

Work in Progress

Inspired by Access Control.

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Scala (28,656
Role (17,671
Permission (11,613
Authorization (5,850
Rbac (1,373
Access Control (1,111
Abac (182
Role Based Access Control (82