pundit v0.0.1 Pundit.DefaultPolicy behaviour View Source

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

Link to this callback

create?(thing, user) View Source
create?(thing :: struct() | module(), user :: term()) :: boolean()

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

Link to this callback

delete?(thing, user) View Source
delete?(thing :: struct() | module(), user :: term()) :: boolean()

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

Link to this callback

edit?(thing, user) View Source
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.

Link to this callback

index?(thing, user) View Source
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.

Link to this callback

new?(thing, user) View Source
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.

Link to this callback

show?(thing, user) View Source
show?(thing :: struct() | module(), user :: term()) :: boolean()

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

Link to this callback

update?(thing, user) View Source
update?(thing :: struct() | module(), user :: term()) :: boolean()

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