Skip to content
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

Public space is not displayed when guest user accesses "Space directory". #3704

Closed
sakurafarm opened this issue Oct 27, 2019 · 11 comments
Closed

Comments

@sakurafarm
Copy link

What steps will reproduce the problem?

  1. Administration -> Users-> Settings -> General -> Enable "Allow limited access for non-authenticated users (guests)"

  2. Create a public space (VISIBILITY_ALL) that guests and registered users can access.

  3. Access "Space directory" as a guest user. (Directory -> Spaces)

What is the expected result?

Public space is displayed.

What do you get instead?

Public space is not displayed.

Additional info

Q A
HumHub version 1.4.0-beta.1
PHP version 7.1
@buddh4
Copy link
Contributor

buddh4 commented Oct 29, 2019

Could not reproduce this issue, you probably have to rebuild the search index. http://docs.humhub.org/admin-search.html#index-rebuilding

@sakurafarm
Copy link
Author

The search index was rebuilt, but public space is not visible to guest users.

It is displayed without problems for the logged-in user.

It may be a wrong fix, but if I set the space.visibility of ActiveQuerySpace.php (Line56) to 2, it will be displayed correctly even for guest users.

@buddh4
Copy link
Contributor

buddh4 commented Nov 12, 2019

Yes there is a public visibility (members only) and a public visibility (members and guests) this can be changed in the space security settigns

@buddh4 buddh4 closed this as completed Nov 12, 2019
@sakurafarm
Copy link
Author

sakurafarm commented Dec 18, 2019

@buddh4
It was not displayed even in 1.4.0-beta.2.

2019-12-18_10h51_31

2019-12-18_10h26_57

@buddh4
Copy link
Contributor

buddh4 commented Dec 18, 2019

@luke- , I can only imagin a search index issue? Any idea?

@sakurafarm
Copy link
Author

@buddh4
I noticed that public spaces(members and guests) where the logged-in user is not a member are not displayed in the space directory.

2019-12-19_09h33_15

I think the cause is the humhub\modules\space\components\ActiveQuerySpace visible ().

@buddh4
Copy link
Contributor

buddh4 commented Dec 19, 2019

@luke- there is space visibility_all missing in the visibility query?

if ($user !== null) {
$spaceIds = array_map(function (Membership $membership) {
return $membership->space_id;
}, Membership::findAll(['user_id' => $user->id]));
$this->andWhere(['OR',
['space.visibility' => 1],
['IN', 'space.id', $spaceIds]
]);
} else {
$this->andWhere(['space.visibility' => 1]);
}
return $this;
}

Also if user is null space.visibility needs to be 2 ?

@buddh4 buddh4 added this to the v1.4 milestone Dec 19, 2019
@luke- luke- closed this as completed Dec 20, 2019
@sakurafarm
Copy link
Author

@luke- 0ffed46 is not compatible with Humhub1.3 for displaying results.

In Humhub 1.3, the space VISIBILITY_REGISTERED_ONLY and VISIBILITY_ALL will be displayed to guest users. I think this specification is desirable.

Is it possible to include both VISIBILITY_REGISTERED_ONLY and VISIBILITY_ALL in the search condition when a guest user?

@ArchBlood
Copy link
Contributor

I believe you'd have to use something like this

Not tested

            }, Membership::findAll(['user_id' => $user->id]));
            $this->andWhere(['OR',
                ['space.visibility' => 1],
                ['!=', 'space.visibility', Space::VISIBILITY_REGISTERED_ONLY && Space::VISIBILITY_ALL],
                ['IN', 'space.id', $spaceIds]
            ]);
        } else {
            $this->andWhere(['space.visibility' => 1]);
            $this->andWhere(['space.visibility' => Space::VISIBILITY_REGISTERED_ONLY && Space::VISIBILITY_ALL]);
        }
        return $this;
    }

@buddh4
Copy link
Contributor

buddh4 commented Jan 3, 2020

Should this be configurable, I'am not sure if its obvious that VISIBILITY_REGISTERED_ONLY spaces are visible for guests in the directory. But I see that this can be desirable in some cases.

At least there should be a help text that this space will show up for guests in the directory.

@buddh4
Copy link
Contributor

buddh4 commented Jan 24, 2020

@luke- what do you think?

@luke- luke- self-assigned this Jan 28, 2020
@luke- luke- closed this as completed in 0ffed46 Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants