Skip to content

Commit 5b72d15

Browse files
committed
do not offer to change display name or password, if not possible.
Fixes #12319 Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
1 parent 836ba4f commit 5b72d15

File tree

8 files changed

+22
-8
lines changed

8 files changed

+22
-8
lines changed

apps/provisioning_api/lib/Controller/AUserData.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
namespace OCA\Provisioning_API\Controller;
2323

2424
use OC\Accounts\AccountManager;
25+
use OC\User\Backend;
2526
use OCP\AppFramework\OCS\OCSException;
2627
use OCP\AppFramework\OCS\OCSNotFoundException;
2728
use OCP\AppFramework\OCSController;
@@ -32,6 +33,8 @@
3233
use OCP\IRequest;
3334
use OCP\IUserManager;
3435
use OCP\IUserSession;
36+
use OCP\User\Backend\ISetDisplayNameBackend;
37+
use OCP\User\Backend\ISetPasswordBackend;
3538

3639
abstract class AUserData extends OCSController {
3740

@@ -125,6 +128,12 @@ protected function getUserData(string $userId): array {
125128
$data['language'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang');
126129
$data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale');
127130

131+
$backend = $targetUserObject->getBackend();
132+
$data['backendCapabilities'] = [
133+
'setDisplayName' => $backend instanceof ISetDisplayNameBackend || $backend->implementsActions(Backend::SET_DISPLAYNAME),
134+
'setPassword' => $backend instanceof ISetPasswordBackend || $backend->implementsActions(Backend::SET_PASSWORD),
135+
];
136+
128137
return $data;
129138
}
130139

lib/public/IUser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
namespace OCP;
2828

29+
use OCP\UserInterface;
30+
2931
/**
3032
* Interface IUser
3133
*
@@ -111,6 +113,7 @@ public function getBackendClassName();
111113
/**
112114
* Get the backend for the current user object
113115
*
116+
* @return UserInterface
114117
* @since 15.0.0
115118
*/
116119
public function getBackend();

settings/js/4.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings/js/5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings/js/5.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings/js/settings-admin-security.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings/js/settings-vue.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings/src/components/userList/userRow.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@
4242
<!-- dirty hack to ellipsis on two lines -->
4343
<div class="name">{{user.id}}</div>
4444
<form class="displayName" :class="{'icon-loading-small': loading.displayName}" v-on:submit.prevent="updateDisplayName">
45-
<input :id="'displayName'+user.id+rand" type="text"
45+
<input v-if="user.backendCapabilities.setDisplayName"
46+
:id="'displayName'+user.id+rand" type="text"
4647
:disabled="loading.displayName||loading.all"
4748
:value="user.displayname" ref="displayName"
4849
autocomplete="new-password" autocorrect="off" autocapitalize="off" spellcheck="false" />
49-
<input type="submit" class="icon-confirm" value="" />
50+
<input v-if="user.backendCapabilities.setDisplayName" type="submit" class="icon-confirm" value="" />
51+
<div v-if="!user.backendCapabilities.setDisplayName" class="name">{{user.displayname}}</div>
5052
</form>
51-
<form class="password" v-if="settings.canChangePassword" :class="{'icon-loading-small': loading.password}"
53+
<form class="password" v-if="settings.canChangePassword && user.backendCapabilities.setPassword" :class="{'icon-loading-small': loading.password}"
5254
v-on:submit.prevent="updatePassword">
5355
<input :id="'password'+user.id+rand" type="password" required
5456
:disabled="loading.password||loading.all" :minlength="minPasswordLength"

0 commit comments

Comments
 (0)