View Source Appwrite.Utils.Permission (appwrite v0.1.9)

A helper module for generating permission strings for resources.

Summary

Functions

Generates a create permission string for the provided role.

Generates a delete permission string for the provided role.

Generates a read permission string for the provided role.

Generates an update permission string for the provided role.

Generates a write permission string for the provided role.

Functions

create(role)

@spec create(String.t()) :: String.t()

Generates a create permission string for the provided role.

Parameters

  • role: A string representing the role.

Examples

iex> Permission.create("editor")
"create("editor")"

delete(role)

@spec delete(String.t()) :: String.t()

Generates a delete permission string for the provided role.

Parameters

  • role: A string representing the role.

Examples

iex> Permission.delete("admin")
"delete("admin")"

read(role)

@spec read(String.t()) :: String.t()

Generates a read permission string for the provided role.

Parameters

  • role: A string representing the role.

Examples

iex> Permission.read("user")
"read("user")"

update(role)

@spec update(String.t()) :: String.t()

Generates an update permission string for the provided role.

Parameters

  • role: A string representing the role.

Examples

iex> Permission.update("moderator")
"update("moderator")"

write(role)

@spec write(String.t()) :: String.t()

Generates a write permission string for the provided role.

This is an alias of update, delete, and possibly create. Avoid using write in combination with update, delete, or create.

Parameters

  • role: A string representing the role.

Examples

iex> Permission.write("admin")
"write("admin")"