Procedural File: access_api.php
Source Location: /core/access_api.php
Includes
require constaint_inc.php for NOBODY etc
requires authentication_api
Globals
array
$g_cache_access_matrix
[line 66]
Default value: array()
array
$g_cache_access_matrix_project_ids
[line 72]
Default value: array()
array
$g_cache_access_matrix_user_ids
[line 78]
Default value: array()
Functions
access_can_close_bug [line 502]
bool access_can_close_bug(
int $p_bug_id, [int|null $p_user_id = null]
)
|
|
Check if the current user can close the specified bug
Parameters:
|
int |
$p_bug_id: |
integer representing bug id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access to close bugs |
| Access: | public |
access_can_reopen_bug [line 535]
bool access_can_reopen_bug(
int $p_bug_id, [int|null $p_user_id = null]
)
|
|
Check if the current user can reopen the specified bug
Parameters:
|
int |
$p_bug_id: |
integer representing bug id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access to reopen bugs |
| Access: | public |
access_compare_level [line 206]
bool access_compare_level(
int $p_user_access_level, [int|array $p_threshold = NOBODY]
)
|
|
Check the a user's access against the given "threshold" and return true if the user can access, false otherwise.
$p_access_level may be a single value, or an array. If it is a single value, treat it as a threshold so return true if user is >= threshold. If it is an array, look for exact matches to one of the values
Parameters:
|
int |
$p_user_access_level: |
user access level |
|
int|array |
$p_threshold: |
access threshold, defaults to NOBODY |
API Tags:
| Return: | true or false depending on whether given access level matches the threshold |
| Access: | public |
access_denied [line 85]
Function to be called when a user is attempting to access a page that he/she is not authorised to. This outputs an access denied message then re-directs to the mainpage.
access_ensure_bugnote_level [line 489]
void access_ensure_bugnote_level(
int $p_access_level, int $p_bugnote_id, [int|null $p_user_id = null]
)
|
|
Check if the user has the specified access level for the given bugnote
and deny access to the page if not
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int |
$p_bugnote_id: |
integer representing bugnote id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
access_ensure_bug_level [line 447]
bool access_ensure_bug_level(
int $p_access_level, int $p_bug_id, [int|null $p_user_id = null]
)
|
|
Check if the user has the specified access level for the given bug
and deny access to the page if not
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int |
$p_bug_id: |
integer representing bug id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
access_ensure_can_close_bug [line 522]
void access_ensure_can_close_bug(
int $p_bug_id, [int|null $p_user_id = null]
)
|
|
Make sure that the current user can close the specified bug
Parameters:
|
int |
$p_bug_id: |
integer representing bug id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
access_ensure_can_reopen_bug [line 556]
void access_ensure_can_reopen_bug(
int $p_bug_id, [int|null $p_user_id = null]
)
|
|
Make sure that the current user can reopen the specified bug.
Calls access_denied if user has no access to terminate script
Parameters:
|
int |
$p_bug_id: |
integer representing bug id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
access_ensure_global_level [line 267]
void access_ensure_global_level(
int $p_access_level, [int|null $p_user_id = null]
)
|
|
Check if the user has the specified global access level
and deny access to the page if not
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
access_ensure_project_level [line 363]
void access_ensure_project_level(
int $p_access_level, [int|null $p_project_id = null], [int|null $p_user_id = null]
)
|
|
Check if the user has the specified access level for the given project
and deny access to the page if not
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int|null |
$p_project_id: |
integer representing project id to check access against, defaults to null to use current project |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
access_get_global_level [line 221]
int access_get_global_level(
[int|null $p_user_id = null]
)
|
|
This function only checks the user's global access level, ignoring any
overrides they might have at a project level
Parameters:
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | global access level |
| Access: | public |
access_get_local_level [line 570]
bool|int access_get_local_level(
int $p_user_id, int $p_project_id
)
|
|
get the user's access level specific to this project.
return false (0) if the user has no access override here
Parameters:
|
int |
$p_user_id: |
Integer representing user id |
|
int |
$p_project_id: |
integer representing project id |
API Tags:
| Return: | returns false (if no access) or an integer representing level of access |
| Access: | public |
access_get_project_level [line 282]
int access_get_project_level(
[int $p_project_id = null], [int|null $p_user_id = null]
)
|
|
This function checks the project access level first (for the current project if none is specified) and if the user is not listed, it falls back on the user's global access level.
Parameters:
|
int |
$p_project_id: |
integer representing project id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | access level user has to given project |
| Access: | public |
access_get_status_threshold [line 603]
int access_get_status_threshold(
int $p_status, [int $p_project_id = ALL_PROJECTS]
)
|
|
get the access level required to change the issue to the new status If there is no specific differentiated access level, use the generic update_bug_status_threshold.
Parameters:
|
int |
$p_status: |
|
|
int |
$p_project_id: |
Default value ALL_PROJECTS |
API Tags:
| Return: | integer representing user level e.g. DEVELOPER |
| Access: | public |
Information Tags:
| Todo: | p_project_id is unused |
access_has_any_project [line 376]
bool access_has_any_project(
int $p_access_level, [int|null $p_user_id = null]
)
|
|
Check whether the user has the specified access level for any project project
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access level specified |
| Access: | public |
access_has_bugnote_level [line 464]
bool access_has_bugnote_level(
int $p_access_level, int $p_bugnote_id, [int|null $p_user_id = null]
)
|
|
Check the current user's access against the given value and return true if the user's access is equal to or higher, false otherwise.
This function looks up the bugnote's bug and performs an access check against that bug
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int |
$p_bugnote_id: |
integer representing bugnote id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access level specified |
| Access: | public |
access_has_bug_level [line 407]
bool access_has_bug_level(
int $p_access_level, int $p_bug_id, [int|null $p_user_id = null]
)
|
|
Check the current user's access against the given value and return true if the user's access is equal to or higher, false otherwise.
This function looks up the bug's project and performs an access check against that project
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int |
$p_bug_id: |
integer representing bug id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access level specified |
| Access: | public |
access_has_global_level [line 244]
bool access_has_global_level(
int $p_access_level, [int|null $p_user_id = null]
)
|
|
Check the current user's access against the given value and return true if the user's access is equal to or higher, false otherwise.
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access level specified |
| Access: | public |
access_has_project_level [line 336]
bool access_has_project_level(
int $p_access_level, [int $p_project_id = null], [int|null $p_user_id = null]
)
|
|
Check the current user's access against the given value and return true if the user's access is equal to or higher, false otherwise.
Parameters:
|
int |
$p_access_level: |
integer representing access level |
|
int |
$p_project_id: |
integer representing project id to check access against |
|
int|null |
$p_user_id: |
integer representing user id, defaults to null to use current user |
API Tags:
| Return: | whether user has access level specified |
| Access: | public |
|
|