move rhailib to herolib
This commit is contained in:
50
rhailib/examples/access_control/alice.rhai
Normal file
50
rhailib/examples/access_control/alice.rhai
Normal file
@@ -0,0 +1,50 @@
|
||||
new_circle()
|
||||
.title("Alice's Circle")
|
||||
.description("Some objects in this circle are shared with Bob")
|
||||
.save_circle();
|
||||
|
||||
let private_object = new_object()
|
||||
.title("Alice's Private Object")
|
||||
.description("This object can only be seen and modified by Alice")
|
||||
.save_object();
|
||||
|
||||
let object_shared_with_bob = new_object()
|
||||
.title("Alice's Shared Object")
|
||||
.description("This object can be seen by Bob but modified only by Alice")
|
||||
.save_object();
|
||||
|
||||
let new_access = new_access()
|
||||
.object_id(object_shared_with_bob.id())
|
||||
.circle_public_key("bob_pk")
|
||||
.save_access();
|
||||
|
||||
let book_private = new_book()
|
||||
.title("Alice's private book")
|
||||
.description("This book is prive to Alice")
|
||||
.save_book();
|
||||
|
||||
let slides_shared = new_slides()
|
||||
.title("Alice's shared slides")
|
||||
.description("These slides, despite being in a private collection, are shared with Bob")
|
||||
.save_slides();
|
||||
|
||||
let new_access = new_access()
|
||||
.object_id(slides_shared.id)
|
||||
.circle_public_key("bob_pk")
|
||||
.save_access();
|
||||
|
||||
let collection_private = new_collection()
|
||||
.title("Alice's private collection")
|
||||
.description("This collection is only visible to Alice")
|
||||
.add_book(book_private.id)
|
||||
.add_slides(slides_shared.id)
|
||||
.save_collection();
|
||||
|
||||
|
||||
let collection_shared = new_collection()
|
||||
.title("Alice's shared collection")
|
||||
.description("This collection is shared with Bob")
|
||||
.save_collection();
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user