-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another system config: allow_user_to_change_email_address #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,14 +47,15 @@ abstract class Backend implements UserInterface { | |
public const SET_DISPLAYNAME = 1048576; // 1 << 20 | ||
public const PROVIDE_AVATAR = 16777216; // 1 << 24 | ||
public const COUNT_USERS = 268435456; // 1 << 28 | ||
|
||
public const SET_EMAILADDRESS = 4294967296; // 1 << 32 | ||
protected $possibleActions = [ | ||
self::CREATE_USER => 'createUser', | ||
self::SET_PASSWORD => 'setPassword', | ||
self::CHECK_PASSWORD => 'checkPassword', | ||
self::GET_HOME => 'getHome', | ||
self::GET_DISPLAYNAME => 'getDisplayName', | ||
self::SET_DISPLAYNAME => 'setDisplayName', | ||
self::SET_EMAILADDRESS => 'setEMailAddress', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @theronakpatel Where is this change coming from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @akhil1508 In this file actions are defined. We already have |
||
self::PROVIDE_AVATAR => 'canChangeAvatar', | ||
self::COUNT_USERS => 'countUsers', | ||
]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,14 @@ public function canChangePassword(); | |
*/ | ||
public function canChangeDisplayName(); | ||
|
||
/** | ||
* check if the backend supports changing email addresses | ||
* | ||
* @return bool | ||
* @since 8.0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its since 28.0.0? It's a change we are introducing now.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IG, current is 27.0.0, so yes from 28.0.0 @akhil1508 |
||
*/ | ||
public function canChangeEmailAddress(); | ||
|
||
/** | ||
* check if the user is enabled | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,6 +373,31 @@ public function testCanChangeDisplayName() { | |
$this->assertTrue($user->canChangeDisplayName()); | ||
} | ||
|
||
public function testCanChangeEmailAddress() { | ||
/** | ||
* @var Backend | MockObject $backend | ||
*/ | ||
$backend = $this->createMock(\Test\Util\User\Dummy::class); | ||
|
||
$backend->expects($this->any()) | ||
->method('implementsActions') | ||
->willReturnCallback(function ($actions) { | ||
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SET_EMAILADDRESS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes @akhil1508 |
||
return true; | ||
} else { | ||
return false; | ||
} | ||
}); | ||
|
||
$config = $this->createMock(IConfig::class); | ||
$config->method('getSystemValueBool') | ||
->with('allow_user_to_change_email_address') | ||
->willReturn(true); | ||
|
||
$user = new User('foo', $backend, $this->dispatcher, null, $config); | ||
$this->assertTrue($user->canChangeEmailAddress()); | ||
} | ||
|
||
public function testCanChangeDisplayNameNotSupported() { | ||
/** | ||
* @var Backend | MockObject $backend | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be a different variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.