Skip to content

3.2) Hooks: List

Marco Cesarato edited this page Apr 11, 2019 · 10 revisions

All hooks

Hook Type Description Params Return Default function
custom_api_call Action Create custom API Call (ex. localhost/example/custom/call.json) action_custom_api_call
sql_restriction Filter Add restriction on where conditions for each query (string) $restriction (string) $table (string) $permission String filter_sql_restriction
can_read Filter Return if can get/select (bool) $permission = true Bool filter_can_read
can_write Filter Return if can post/insert (bool) $permission = true Bool filter_can_write
can_edit Filter Return if can put/update (bool) $permission = true Bool filter_can_edit
can_delete Filter Return if can delete (bool) $permission = true Bool filter_can_delete
on_read Filter Result content returned on get/read (array) $data (string) $table Array filter_on_read
on_write Filter Result content returned on post/write (array) $data (string) $table Array filter_on_write
on_edit Filter Result content returned on put/edit (array) $data (string) $table Array filter_on_edit
on_delete Filter Get result content returned on delete (array) $data (string) $table Array filter_on_delete
validate_token Filter Validate token (bool) $is_valid (sstring) $token Bool filter_validate_token
auth_user_id Filter Filter user auth login id to force one (string) $user_id String filter_auth_user_id
bypass_authentication Filter Bypass authentication (bool) $bypass = false Bool filter_bypass_authentication
check_login_request Filter Check if is a login request (bool) $is_valid_request = false (array) $query Bool filter_check_login_request

Hooks detail

  • Filter: sql_restriction

    Options of $permission:

    case 'READ':
    case 'EDIT':
    case 'DELETE':

    Return

    // All denied
    $sql = "'1' = '0'";
    // All allowed
    $sql = "'1' = '1'";

    Examples:

    // Only Created
    $sql = 'created_by = '.$user['id'];
    // Only Team
    $sql = 'created_by IN ('.implode(',',$teams_ids).')';
Clone this wiki locally