1
1
Fork 0

Rename method again

This commit is contained in:
Philipp Holzer 2021-10-17 23:12:26 +02:00
parent b5d994394e
commit 64a336ee8d
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
7 changed files with 11 additions and 11 deletions

View file

@ -86,7 +86,7 @@ class Objects extends BaseModule
$permissionSets = DI::permissionSet()->selectByContactId($requester_id, $item['uid']); $permissionSets = DI::permissionSet()->selectByContactId($requester_id, $item['uid']);
if (!empty($permissionSets)) { if (!empty($permissionSets)) {
$psid = array_merge($permissionSets->column('id'), $psid = array_merge($permissionSets->column('id'),
[DI::permissionSet()->selectPublic($item['uid'])]); [DI::permissionSet()->selectPublicForUser($item['uid'])]);
$validated = in_array($item['psid'], $psid); $validated = in_array($item['psid'], $psid);
} }
} }

View file

@ -213,7 +213,7 @@ class Status extends BaseProfile
$permissionSets = DI::permissionSet()->selectByContactId($remote_user, $profile['uid']); $permissionSets = DI::permissionSet()->selectByContactId($remote_user, $profile['uid']);
if (!empty($permissionSets)) { if (!empty($permissionSets)) {
$condition = ['psid' => array_merge($permissionSets->column('id'), $condition = ['psid' => array_merge($permissionSets->column('id'),
[DI::permissionSet()->selectPublic($profile['uid'])->id])]; [DI::permissionSet()->selectPublicForUser($profile['uid'])->id])];
} }
} elseif ($profile['uid'] == local_user()) { } elseif ($profile['uid'] == local_user()) {
$condition = []; $condition = [];

View file

@ -125,7 +125,7 @@ class ProfileField extends BaseDepository
public function selectPublicFieldsByUserId(int $uid): Collection\ProfileFields public function selectPublicFieldsByUserId(int $uid): Collection\ProfileFields
{ {
try { try {
$publicPermissionSet = $this->permissionSetDepository->selectPublic($uid); $publicPermissionSet = $this->permissionSetDepository->selectPublicForUser($uid);
return $this->select([ return $this->select([
'uid' => $uid, 'uid' => $uid,
@ -168,7 +168,7 @@ class ProfileField extends BaseDepository
$permissionSetIds = $permissionSets->column('id'); $permissionSetIds = $permissionSets->column('id');
// Includes public custom fields // Includes public custom fields
$permissionSetIds[] = $this->permissionSetDepository->selectPublic($uid)->id; $permissionSetIds[] = $this->permissionSetDepository->selectPublicForUser($uid)->id;
return $this->select( return $this->select(
['uid' => $uid, 'psid' => $permissionSetIds], ['uid' => $uid, 'psid' => $permissionSetIds],

View file

@ -229,7 +229,7 @@ class Transmitter
$permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']); $permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']);
if (!empty($permissionSets)) { if (!empty($permissionSets)) {
$condition = ['psid' => array_merge($permissionSets->column('id'), $condition = ['psid' => array_merge($permissionSets->column('id'),
[DI::permissionSet()->selectPublic($owner['uid'])])]; [DI::permissionSet()->selectPublicForUser($owner['uid'])])];
} }
} }
} }

View file

@ -202,7 +202,7 @@ class PermissionSet extends BaseDepository
* *
* @return Entity\PermissionSet * @return Entity\PermissionSet
*/ */
public function selectPublic(int $uid): Entity\PermissionSet public function selectPublicForUser(int $uid): Entity\PermissionSet
{ {
return $this->factory->createFromString($uid, '', '', '', '', self::PUBLIC); return $this->factory->createFromString($uid, '', '', '', '', self::PUBLIC);
} }
@ -222,7 +222,7 @@ class PermissionSet extends BaseDepository
// Don't select/update Public permission sets // Don't select/update Public permission sets
if ($this->checkPublic($permissionSet)) { if ($this->checkPublic($permissionSet)) {
return $this->selectPublic($permissionSet->uid); return $this->selectPublicForUser($permissionSet->uid);
} }
try { try {
@ -242,7 +242,7 @@ class PermissionSet extends BaseDepository
{ {
// Don't save/update the common public PermissionSet // Don't save/update the common public PermissionSet
if ($this->checkPublic($permissionSet)) { if ($this->checkPublic($permissionSet)) {
return $this->selectPublic($permissionSet->uid); return $this->selectPublicForUser($permissionSet->uid);
} }
$fields = $this->convertToTableRow($permissionSet); $fields = $this->convertToTableRow($permissionSet);

View file

@ -136,12 +136,12 @@ class ProfileFieldTest extends DatabaseTest
self::assertEquals($savedProfileField, $selectedProfileField); self::assertEquals($savedProfileField, $selectedProfileField);
$savedProfileField->update('another', 5, $this->permissionSetDepository->selectPublic(42)); $savedProfileField->update('another', 5, $this->permissionSetDepository->selectPublicForUser(42));
self::assertEquals(PermissionSet::PUBLIC, $savedProfileField->permissionSet->id); self::assertEquals(PermissionSet::PUBLIC, $savedProfileField->permissionSet->id);
$publicProfileField = $this->depository->save($savedProfileField); $publicProfileField = $this->depository->save($savedProfileField);
self::assertEquals($this->permissionSetDepository->selectPublic(42), $publicProfileField->permissionSet); self::assertEquals($this->permissionSetDepository->selectPublicForUser(42), $publicProfileField->permissionSet);
self::assertEquals('another', $publicProfileField->value); self::assertEquals('another', $publicProfileField->value);
self::assertEquals(5, $publicProfileField->order); self::assertEquals(5, $publicProfileField->order);
} }

View file

@ -31,7 +31,7 @@ class PermissionSetTest extends DatabaseTest
public function testSelectOneByIdPublic() public function testSelectOneByIdPublic()
{ {
$permissionSet = $this->depository->selectPublic(1); $permissionSet = $this->depository->selectPublicForUser(1);
$this->assertInstanceOf(\Friendica\Security\PermissionSet\Entity\PermissionSet::class, $permissionSet); $this->assertInstanceOf(\Friendica\Security\PermissionSet\Entity\PermissionSet::class, $permissionSet);
self::assertEmpty($permissionSet->allow_cid); self::assertEmpty($permissionSet->allow_cid);