RestAuth v1.1.2 RestAuth.Restrict View Source

RestAuth.Restrict is used to secure endpoints.

Example

@rest_auth_roles  [
  {:index, ["user"]},
  {:create, ["admin"]},
  {:update, ["admin"]},
  {:show, ["admin"]},
  {:delete, ["admin"]},
  {:ping, :permit_all}
]
plug RestAuth.Restrict @rest_auth_roles

In this sample usage I have simply listed the roles in an attribute for readability. The parameter has to be a keyword list of string lists or atom :permit_all.

Link to this section Summary

Functions

Checks given roles against current user

Required initiation method

Link to this section Functions

Checks given roles against current user.

Required initiation method