Openmaize.IdCheck

Plug to perform a further check based on the user id.

This plug needs to be called after Openmaize.Authorize, which makes the initial authorization checks.

For this plug to work, you need to have the start of the path and the start of the path + “/:id” in the protected map in the config. For example, the following entry protects “/users” and checks ids under “/users”:

config: openmaize,
  protected: %{"/users" => ["user"], "/users/:id" => ["user"]}

There are two options:

Examples

Call IdCheck without any options:

Plug Openmaize.IdCheck

Call IdCheck without redirects:

Plug Openmaize.IdCheck, redirects: false

Call IdCheck and allow users to view the pages of other ids:

Plug Openmaize.IdCheck, show: true
Source

Summary

call(conn, opts)

Verify that the user, based on id, is authorized to access the page / resource

init(opts)

Callback implementation for c:Plug.init/1

Functions

call(conn, opts)

Verify that the user, based on id, is authorized to access the page / resource.

Source
init(opts)

Callback implementation for c:Plug.init/1.

Source