Wraith.Policy (Wraith v0.1.0)

View Source

Who may do what, Ghost's staff roles:

  • owner — everything, including settings, billing, API keys and staff
  • admin — everything but transferring ownership
  • editor — every post, tags, members, comments; not settings or staff
  • author — their own posts (create, edit, publish, delete), their profile
  • contributor — their own drafts; cannot publish or delete published work

can?(user, action, subject) answers it; LiveViews call it before writing and the rail hides what a role may not reach.

Summary

Functions

The roles a user may assign: owners hand out anything but owner; admins the same.

Types

action()

@type action() ::
  :manage_settings
  | :manage_staff
  | :manage_members
  | :manage_comments
  | :manage_widgets
  | :manage_tags
  | :use_studio
  | :manage_keys
  | :edit_post
  | :publish_post
  | :delete_post
  | :create_post
  | :send_newsletter

Functions

assignable(arg1)

The roles a user may assign: owners hand out anything but owner; admins the same.

can?(u, action, post)

@spec can?(map() | nil, action(), map() | nil) :: boolean()

roles()