Skip to content

Commit

Permalink
Group leader couldn't assign members if profile field street is miss…
Browse files Browse the repository at this point in the history
…ing #1317
  • Loading branch information
Fasse committed Oct 24, 2022
1 parent 4ad8e6b commit f747dea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions adm_program/system/classes/ProfileFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ public function isEditable(string $fieldNameIntern, bool $allowedToEditProfile):
*/
public function isVisible(string $fieldNameIntern, bool $allowedToEditProfile = false): bool
{
if(!array_key_exists($fieldNameIntern, $this->mProfileFields)) {
return false;
}

// check a special case where the field is only visible for users who can edit the profile but must therefore
// have the right to edit all users
if (!$GLOBALS['gCurrentUser']->editUsers()
Expand All @@ -516,8 +520,7 @@ public function isVisible(string $fieldNameIntern, bool $allowedToEditProfile =
// check if the current user could view the category of the profile field
// if it's the own profile than we check if user could edit his profile and if so he could view all fields
// check if the profile field is only visible for users that could edit this
return ((array_key_exists($fieldNameIntern, $this->mProfileFields) && $this->mProfileFields[$fieldNameIntern]->isVisible())
|| $GLOBALS['gCurrentUserId'] === $this->mUserId)
return ($this->mProfileFields[$fieldNameIntern]->isVisible() || $GLOBALS['gCurrentUserId'] === $this->mUserId)
&& ($allowedToEditProfile || $this->mProfileFields[$fieldNameIntern]->getValue('usf_hidden') == 0);
}

Expand Down

0 comments on commit f747dea

Please sign in to comment.