Skip to content

Commit 7baf830

Browse files
committed
return always null for user.is_admin; closes #546
1 parent 7a87325 commit 7baf830

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

okapi/services/users/user/docs.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@
2828
<li><b>profile_url</b> - URL of the user's Opencaching profile page,</li>
2929
<li class='deprecated'>
3030
<p><b>is_admin</b> - deprecated
31-
(<a href='https://github.com/opencaching/okapi/issues/410'>why?</a>).
32-
boolean, true is user has admin privileges.</p>
33-
<p>This value can be accessed only with <b>Level 3</b> Authentication
34-
and only for the user of your Access Token. For all other reads, is_admin
35-
will equal <b>null</b>.</p>
31+
(<a href='https://github.com/opencaching/okapi/issues/410'>why?</a>),
32+
always <b>null</b>.</p>
3633
</li>
3734
<li>
3835
<b>internal_id</b> - internal ID of the user (<b>DO NOT</b> use this!

okapi/services/users/users/WebService.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,7 @@ public static function call(OkapiRequest $request)
5959
case 'uuid': $entry['uuid'] = $row['uuid']; break;
6060
case 'username': $entry['username'] = $row['username']; break;
6161
case 'profile_url': $entry['profile_url'] = Settings::get('SITE_URL')."viewprofile.php?userid=".$row['user_id']; break;
62-
case 'is_admin':
63-
if (!$request->token) {
64-
$entry['is_admin'] = null;
65-
} elseif ($request->token->user_id != $row['user_id']) {
66-
$entry['is_admin'] = null;
67-
} else {
68-
$entry['is_admin'] = $row['admin'] ? true : false;
69-
}
70-
break;
62+
case 'is_admin': $entry['is_admin'] = null; break;
7163
case 'internal_id': $entry['internal_id'] = $row['user_id']; break;
7264
case 'date_registered':
7365
$entry['date_registered'] = date("Y-m-d", strtotime($row['date_created']));

0 commit comments

Comments
 (0)