View Source Pundit.DefaultPolicy behaviour (pundit v1.0.2)

Default access policies for a given type.

All of the functions here are named for actions in a Phoenix controller.

If you use this module, then default implementations will be added in your module that all return false by default (default safe, nothing is permitted). All are overrideable.

Link to this section Summary

Callbacks

Returns true only if the user should be allowed to create a new kind of thing.

Returns true only if the user should be allowed to delete a thing.

Returns true only if the user should be allowed to see a form for updating the thing.

Returns true only if the user should be allowed to see an index (list) of the given things.

Returns true only if the user should be allowed to see a form to create a new thing.

Returns true only if the user should be allowed to see the given thing.

Returns true only if the user should be allowed to update the attributes of a thing.

Link to this section Callbacks

@callback create?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to create a new kind of thing.

@callback delete?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to delete a thing.

@callback edit?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to see a form for updating the thing.

See the page on Phoenix controllers for more details on the purpose of this action.

@callback index?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to see an index (list) of the given things.

@callback new?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to see a form to create a new thing.

See the page on Phoenix controllers for more details on the purpose of this action.

@callback show?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to see the given thing.

@callback update?(thing :: struct() | module(), user :: term()) :: boolean()

Returns true only if the user should be allowed to update the attributes of a thing.