Skip to content

Instantly share code, notes, and snippets.

@deoxxa
Last active January 15, 2021 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deoxxa/dacf17e26879ec8fdf7a to your computer and use it in GitHub Desktop.
Save deoxxa/dacf17e26879ec8fdf7a to your computer and use it in GitHub Desktop.
type_person(bigco_it_guy).
type_person(bigco_big_boss).
type_person(bigco_web_manager).
type_person(bigco_web_worker_1).
type_person(bigco_web_worker_2).
type_person(bigco_web_worker_3).
type_person(bigco_mobile_manager).
type_person(bigco_mobile_worker_1).
type_person(bigco_mobile_worker_2).
type_person(bigco_mobile_worker_3).
type_tenant(bigco).
type_client(bigco_mobile).
type_client(bigco_web).
type_project(bigco_web_landing).
type_project(bigco_web_admin).
type_project(bigco_mobile_landing).
type_project(bigco_mobile_admin).
type_review(bigco_web_landing_review_1).
type_review(bigco_web_landing_review_2).
type_review(bigco_web_admin_review_1).
type_review(bigco_web_admin_review_2).
type_review(bigco_mobile_landing_review_1).
type_review(bigco_mobile_landing_review_2).
type_review(bigco_mobile_admin_review_1).
type_review(bigco_mobile_admin_review_2).
child_of(bigco, bigco_web).
child_of(bigco, bigco_mobile).
child_of(bigco_web, bigco_web_landing).
child_of(bigco_web, bigco_web_admin).
child_of(bigco_mobile, bigco_mobile_landing).
child_of(bigco_mobile, bigco_mobile_admin).
child_of(bigco_web_landing, bigco_web_landing_review_1).
child_of(bigco_web_landing, bigco_web_landing_review_2).
child_of(bigco_web_admin, bigco_web_admin_review_1).
child_of(bigco_web_admin, bigco_web_admin_review_2).
child_of(bigco_mobile_landing, bigco_mobile_landing_review_1).
child_of(bigco_mobile_landing, bigco_mobile_landing_review_2).
child_of(bigco_mobile_admin, bigco_mobile_admin_review_1).
child_of(bigco_mobile_admin, bigco_mobile_admin_review_2).
creator_of(bigco, bigco_it_guy).
creator_of(bigco_web, bigco_big_boss).
creator_of(bigco_mobile, bigco_big_boss).
creator_of(bigco_web_landing, bigco_web_manager).
creator_of(bigco_web_admin, bigco_web_manager).
creator_of(bigco_mobile_landing, bigco_mobile_manager).
creator_of(bigco_mobile_admin, bigco_mobile_manager).
creator_of(bigco_web_landing_review_1, bigco_web_manager).
creator_of(bigco_web_landing_review_2, bigco_web_manager).
creator_of(bigco_web_admin_review_1, bigco_web_manager).
creator_of(bigco_web_admin_review_2, bigco_web_manager).
creator_of(bigco_mobile_landing_review_1, bigco_mobile_manager).
creator_of(bigco_mobile_landing_review_2, bigco_mobile_manager).
creator_of(bigco_mobile_admin_review_1, bigco_mobile_manager).
creator_of(bigco_mobile_admin_review_2, bigco_mobile_manager).
admin_of(bigco, bigco_big_boss).
admin_of(bigco_web, bigco_web_manager).
admin_of(bigco_mobile, bigco_mobile_manager).
user_of(bigco_web_landing, bigco_web_worker_1).
user_of(bigco_web_landing, bigco_web_worker_2).
user_of(bigco_web_admin, bigco_web_worker_2).
user_of(bigco_web_admin, bigco_web_worker_3).
user_of(bigco_mobile_landing, bigco_mobile_worker_1).
user_of(bigco_mobile_landing, bigco_mobile_worker_2).
user_of(bigco_mobile_admin, bigco_mobile_worker_2).
user_of(bigco_mobile_admin, bigco_mobile_worker_3).
descendant(ABOVE, BELOW) :-
child_of(ABOVE, BELOW).
descendant(ABOVE, BELOW) :-
child_of(ABOVE, THROUGH),
descendant(THROUGH, BELOW).
member_of(THING, PERSON) :-
creator_of(THING, PERSON).
member_of(THING, PERSON) :-
admin_of(THING, PERSON).
member_of(THING, PERSON) :-
user_of(THING, PERSON).
can_see_person(PERSON, SOMEONE) :-
member_of(SOMETHING, PERSON),
member_of(SOMETHING, SOMEONE).
can_see_person(PERSON, SOMEONE) :-
member_of(SOMETHING_ABOVE, PERSON),
descendant(SOMETHING_ABOVE, SOMETHING_BELOW),
member_of(SOMETHING_BELOW, SOMEONE).
can_see_thing(PERSON, THING) :-
member_of(THING, PERSON).
can_see_thing(PERSON, THING) :-
descendant(THING, BELOW),
member_of(BELOW, PERSON).
can_see_thing(PERSON, THING) :-
descendant(ABOVE, THING),
member_of(ABOVE, PERSON).
can_modify_thing(PERSON, THING) :-
creator_of(THING, PERSON).
can_modify_thing(PERSON, THING) :-
admin_of(THING, PERSON).
can_modify_thing(PERSON, THING) :-
descendant(ABOVE, THING),
can_modify_thing(PERSON, ABOVE).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment