Skip to content

Commit 8370f4b

Browse files
committed
issue#86 Problem with "Provide avatar" field with user_sql 4.2.1
1 parent 55797f0 commit 8370f4b

5 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
### Added
99
- Reverse active column option
1010
- Support for Nextcloud 16
11+
- Set default value for "provide avatar" option
1112

1213
## [4.2.1] - 2018-12-22
1314
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Name | Description | Details
4949
--- | --- | ---
5050
**Allow display name change** | With this option enabled user can change its display name. The display name change is propagated to the database. | Optional.<br/>Default: false.<br/>Requires: user *Display name* column.
5151
**Allow password change** | Can user change its password. The password change is propagated to the database. See [Hash algorithms](#hash-algorithms). | Optional.<br/>Default: false.
52+
**Allow providing avatar** | Can user provide its avatar. The value is used when column *Provide avatar* is not set. | Optional.<br/>Default: false.
5253
**Case-insensitive username** | Whether user query should be case-sensitive or case-insensitive. | Optional.<br/>Default: false.
5354
**Reverse active column** | Reverse value of active column in user table. | Optional.<br/>Default: false.
5455
**Use cache** | Use database query results cache. The cache can be cleared any time with the *Clear cache* button click. | Optional.<br/>Default: false.

lib/Backend/UserBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ public function canChangeAvatar(string $uid): bool
555555
);
556556

557557
if (empty($this->properties[DB::USER_AVATAR_COLUMN])) {
558-
return false;
558+
return !empty($this->properties[Opt::PROVIDE_AVATAR]);
559559
}
560560

561561
$user = $this->userRepository->findByUid($uid);

lib/Constant/Opt.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ final class Opt
3737
const NAME_CHANGE = "opt.name_change";
3838
const PASSWORD_CHANGE = "opt.password_change";
3939
const PREPEND_SALT = "opt.prepend_salt";
40+
const PROVIDE_AVATAR = "opt.provide_avatar";
4041
const QUOTA_SYNC = "opt.quota_sync";
4142
const REVERSE_ACTIVE = "opt.reverse_active";
4243
const USE_CACHE = "opt.use_cache";

templates/admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function print_select_options(
110110
<fieldset><?php
111111
print_checkbox_input($l, "opt-name_change", "Allow display name change", $_["opt.name_change"]);
112112
print_checkbox_input($l, "opt-password_change", "Allow password change", $_["opt.password_change"]);
113+
print_checkbox_input($l, "opt-provide_avatar", "Allow providing avatar", $_["opt.provide_avatar"]);
113114
print_checkbox_input($l, "opt-case_insensitive_username", "Case-insensitive username", $_["opt.case_insensitive_username"]);
114115
print_checkbox_input($l, "opt-reverse_active", "Reverse active column", $_["opt.reverse_active"]); ?>
115116
<div class="button-right"><?php

0 commit comments

Comments
 (0)