Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

can_edit_tile()

Description

Check if current user can edit dash tile. Users shouldn't be able to edit tiles that they can't view and only dash admins should be able to edit shared tiles.

Parameters

ColumnTypeDefaultDescription
$tileref int
$audience int 0 for tile available to one user, 1 for all users. Typically obtained from get_tile()
$user int Ref of the user editing the tile.
$usertile int Ref of the tile being edited. Typically obtained from get_tile()

Return

bool Will return true if editing is allowed else will return false.

Location

include/dash_functions.php lines 2271 to 2285

Definition

 
function can_edit_tile(int $tilerefint $audienceint $user)
    {
    if (
$audience === 0)
        {
        
// User is trying to edit a tile visible to only them.
        
$result ps_query("SELECT ref, user, dash_tile, order_by FROM user_dash_tile WHERE dash_tile = ? AND user = ?", ['i'$tileref'i'$user]);
        return isset(
$result[0]);
        }
    else
        {
        
// Tile is available to all users so editable only to dash admin users.
        // This includes tiles available to a specified group.
        
return checkPermission_dashadmin();
        }
    }

This article was last updated 14th December 2024 10:35 Europe/London time based on the source file dated 12th December 2024 19:40 Europe/London time.