SecureX.Res (SecureX v0.3.2) View Source

Contains CRUD For Resources.

Link to this section Summary

Functions

Add a Resource. You can send either Atom Map or String Map to add Resource.

Delete a Resource. All Permissions will be removed against this resource.

Get a Resource,

Get list of Resources.

Update a Resource. You can update any resource along with its permissions. You can send either Atom Map or String Map to update Role. It will automatically update resource_id in Permissions table.

Link to this section Functions

Specs

add(map()) :: struct()

Add a Resource. You can send either Atom Map or String Map to add Resource.

Examples

iex> add(%{"res" => "Person Farm"})
%Resource{
  id: "person_farm",
  name: "Persons Farm"
}

Specs

delete(map()) :: struct()

Delete a Resource. All Permissions will be removed against this resource.

Examples

iex> delete(%{"id" => "person_organization")
%Resource{
  id: "person_organization",
  name: "Person Organization",
  permissions: :successfully_removed_permissions
}

Specs

get(map()) :: struct()

Get a Resource,

Examples

iex> get(%{"res" => "person_farm"})
%Resource{
  id: "person_farm",
  name: "Persons Farm"
}

Specs

list() :: [...]

Get list of Resources.

Examples

iex> list()
[
%Resource{
  id: "person_farm",
  name: "Persons Farm"
},
%Resource{
  id: "users",
  name: "Users"
},
...

]

Specs

update(map()) :: struct()

Update a Resource. You can update any resource along with its permissions. You can send either Atom Map or String Map to update Role. It will automatically update resource_id in Permissions table.

Examples

iex> update(%{"id" => "person_farm", "name" => "Person Organization"})
%Resource{
  id: "person_organization",
  name: "Person Organization",
  permissions: :successfully_updated_permissions
}