Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flag-3296124
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
flag-3296124
Commits
76a2aec5
Commit
76a2aec5
authored
16 years ago
by
mooffie
Browse files
Options
Downloads
Patches
Plain Diff
#320271
, [API] Possibility to skip user permission check
parent
c9f72f70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flag.inc
+7
-2
7 additions, 2 deletions
flag.inc
with
7 additions
and
2 deletions
flag.inc
+
7
−
2
View file @
76a2aec5
...
...
@@ -331,11 +331,13 @@ class flag_flag {
* The ID of the item to flag or unflag.
* @param $account
* The user on whose behalf to flag. Leave empty for the current user.
* @param $skip_permission_check
* Flag the item even if the $account user don't have permission to do so.
* @return
* FALSE if some error occured (e.g., user has no permission, flag isn't
* applicable to the item, etc.), TRUE otherwise.
*/
function
flag
(
$action
,
$content_id
,
$account
=
NULL
)
{
function
flag
(
$action
,
$content_id
,
$account
=
NULL
,
$skip_permission_check
=
FALSE
)
{
if
(
!
isset
(
$account
))
{
$account
=
$GLOBALS
[
'user'
];
}
...
...
@@ -352,7 +354,7 @@ class flag_flag {
return
FALSE
;
}
if
(
!
$this
->
user_access
(
$account
))
{
if
(
!
$skip_permission_check
&&
!
$this
->
user_access
(
$account
))
{
// User has no permission to use this flag.
return
FALSE
;
}
...
...
@@ -820,6 +822,7 @@ class flag_node extends flag_flag {
return
array
(
'views table'
=>
'node'
,
'join field'
=>
'nid'
,
'title field'
=>
'title'
,
'title'
=>
t
(
'Node flag'
),
'help'
=>
t
(
'Limit results to only those nodes flagged by a certain flag; Or display information about the flag set on a node.'
),
'counter title'
=>
t
(
'Node flag counter'
),
...
...
@@ -914,6 +917,7 @@ class flag_comment extends flag_flag {
return
array
(
'views table'
=>
'comments'
,
'join field'
=>
'cid'
,
'title field'
=>
'subject'
,
'title'
=>
t
(
'Comment flag'
),
'help'
=>
t
(
'Limit results to only those comments flagged by a certain flag; Or display information about the flag set on a comment.'
),
'counter title'
=>
t
(
'Comment flag counter'
),
...
...
@@ -1009,6 +1013,7 @@ class flag_user extends flag_flag {
return
array
(
'views table'
=>
'users'
,
'join field'
=>
'uid'
,
'title field'
=>
'name'
,
'title'
=>
t
(
'User flag'
),
'help'
=>
t
(
'Limit results to only those users flagged by a certain flag; Or display information about the flag set on a user.'
),
'counter title'
=>
t
(
'User flag counter'
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment