Openmaize.Authorize.IdCheck

Plug to perform the basic authorization check and then a further check based on the user id.

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.Authorize.IdCheck

Call IdCheck without redirects:

plug Openmaize.Authorize.IdCheck, redirects: false

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

plug Openmaize.Authorize.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