Fixed canEditAnything method in EditUserJob
This commit is contained in:
parent
3cd07a38ca
commit
d8808df091
2 changed files with 14 additions and 1 deletions
|
@ -23,7 +23,7 @@ class EditUserJob extends AbstractJob
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$subJob->user = $user;
|
$subJob->setArgument(JobArgs::ARG_USER_ENTITY, $user);
|
||||||
Api::checkPrivileges($subJob);
|
Api::checkPrivileges($subJob);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,4 +36,17 @@ class EditUserJobTest extends AbstractTest
|
||||||
$lines = array_filter(explode("\n", $x));
|
$lines = array_filter(explode("\n", $x));
|
||||||
$this->assert->areEqual(2, count($lines));
|
$this->assert->areEqual(2, count($lines));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCanEditSomething()
|
||||||
|
{
|
||||||
|
$this->grantAccess('changeUserName.own');
|
||||||
|
$user = $this->mockUser();
|
||||||
|
$user = $this->assert->isTrue((new EditUserJob())->canEditAnything($user));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCannotEditAnything()
|
||||||
|
{
|
||||||
|
$user = $this->mockUser();
|
||||||
|
$user = $this->assert->isFalse((new EditUserJob())->canEditAnything($user));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue