/** * Tell wether a visibility is possible or not for the specified right of a caste * * Basic rules are: * - A friend (or "not a member nor an admin") can be seen by himself only * - A member must be seen by other members of the group * - An admin must be seen by other people */ private static function rightsVisibilityIsPossible(Rights $rights, Group $visibility) { if (is_null($visibility)) { return true; } switch ($visibility->ns()) { case 'user': return !$rights->isMe('member') && !$rights->isMe('admin'); case 'binet': case 'free': return !$rights->isMe('admin'); case 'study': return true; } return true; }