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

visibility_requires_access does not work in 1.7 #3176

Closed
Japhys opened this issue Dec 16, 2020 · 21 comments
Closed

visibility_requires_access does not work in 1.7 #3176

Japhys opened this issue Dec 16, 2020 · 21 comments
Assignees

Comments

@Japhys
Copy link

Japhys commented Dec 16, 2020

Hi I am testing my site with 1.7 and while visibility_requires_access: true worked perfectly in 1.6 it does not seem to work in 1.7

Option has been enabled on plugin conf page

Frontmatter has:

access:
  site.login: true
  admin.login: true
login:
  visibility_requires_access: true

Has something else changed?

@Japhys
Copy link
Author

Japhys commented Dec 22, 2020

@mahagr Were you able to reproduce this Matias?

@mahagr
Copy link
Member

mahagr commented Dec 23, 2020

The feature requires plugins.login.dynamic_page_visibility to be set to true. Looks like it defaults to false.

@mahagr
Copy link
Member

mahagr commented Dec 23, 2020

@rhukster This feature has nothing to do with Grav 1.7, in fact, login plugin is the only one that uses the feature at all.

@Japhys
Copy link
Author

Japhys commented Dec 24, 2020

The feature requires plugins.login.dynamic_page_visibility to be set to true. Looks like it defaults to false.

But when I change this is login.yaml it doesn't make a difference

dynamic_page_visibility: true

Tested it with default theme, same issue. Didn't have it before upgrade though

@Japhys
Copy link
Author

Japhys commented Dec 30, 2020

@rhukster can you confirm this is not just my problem? I would like to push 1.7 to my live site but I need this feature to work. Some menu items should be hidden from public

Something I don;t understand. In my live site 1.6 login.yaml the feature plugins.login.dynamic_page_visibility has a default value false, yet it works perfectly. On staging 1.7 both false and true do not work.

@Japhys
Copy link
Author

Japhys commented Dec 30, 2020

It's got something to do with caching. Whenever I disable cache in 1.7 it works flawlessly
Auto, APCu (which is installed on the server) and file method show this behaviour. I can only get it right by disabling it altogether

@Ribero
Copy link

Ribero commented Jan 11, 2021

Hi,

I'm facing the same issue (v1.7.0-rc.20 theme: Learn2 Git Sync v1.6.0)

my menu entry:

title: 'Hidden Entry'
login:
  visibility_requires_access: true
access:
  site.special: true

The plugin login configuration (v3.3.8):

Capture d’écran 2021-01-11 à 11 15 38

Current behavior:

After a refresh the menu disappear then finally reappear during navigation...

Expected behavior:

The menu should be hidden until the user directly access the URL and authenticate.

@rhukster
Copy link
Member

rhukster commented Jan 11, 2021

Visibility in Grav means if it should show up in the menu or not. So this functionality does as it's supposed to do, by hiding the menu item if you don't have access to the page. If you do have access (ie, you are logged in), then you do see it. Imagine it's something like "orders" or "profile".

@Ribero
Copy link

Ribero commented Jan 11, 2021

This is the point : not logged in and I see the menu entry.

@rhukster
Copy link
Member

I cannot replicate that.

I have in user/config/plugins/login.yaml

dynamic_page_visibility: true

Then in my page md:

title: Special
login:
    visibility_requires_access: true
access:
    site.special: true

And i can't see this page in the menu until i login with a user that has site.special access.

What version of Grav + Login are you using?

@Ribero
Copy link

Ribero commented Jan 11, 2021

Thanks for trying.
Strange that you cannot replicate.

Version numbers are in my previous post

@Japhys
Copy link
Author

Japhys commented Jan 12, 2021

Indeed exactly what happens with me. Same versions. At first it looks like it is working. But when you refresh all items reappear. And I am not logged in. Only way to prevent this is disabling all caching.

@mahagr
Copy link
Member

mahagr commented Jan 12, 2021

I couldn't replicate this either. Let's try to track this one down. Is there anything special in the server? AWS? Also have you updated from some older 1.7 version with Flex Pages enabled in the site (admin is fine)? We hid that feature because of it was still having issues like this.

@Japhys
Copy link
Author

Japhys commented Jan 12, 2021

What I did:

Copy production to development. On a local virtualbox running Ubuntu 20.04 / Apache 2.4 / PHP Version 7.4.11 /
Updated to Grav v1.7.0-rc.19 - Admin v1.10.0-rc.19

I also tried upgrading the site on my Linode production server running Ubuntu 20.04 / Apache 2.4 / PHP Version 7.4.11
Same issue

Tried it both with the default theme as my personal theme, same issue

Servers are completely standard

I did not enable flexpages

I will try to install a perfectly clean GRAV cms next weekend, and built the site back up one step at the time

@mahagr
Copy link
Member

mahagr commented Jan 15, 2021

I'm on Ubuntu, too, though I have custom PHP versions -- though none of this should matter, it's not about servers, IMHO.

I'm using default PHP configuration, so opcache and acpu settings should be the same. Caching setting is grav default, so using apcu.

Maybe it would help if you could replicate this in plain grav+admin installation...

@Ribero
Copy link

Ribero commented Jan 16, 2021

My workflow was the following:

  • Build the docker image as specified here
  • Deploy & run in Google Cloud Platform
  • Setup admin (with 2FA)
  • Only use http (will upgrade to https once certificates are available)
  • switch to test release
  • upgraded to 1.7 using Web GUI / Admin plugin
  • set dynamic_page_visibility: true
  • create a new folder and set configuration to hide if not logged

I only use the web admin. I won't use the command line as the access to command line is complex and filtered in my GCP environment.

It should be more easy to reproduce as docker permits to reduce the numbers of things that could impact the feature...

EDIT : With the latest admin panel version: v1.9.19 I cannot view anymore the "access" features of pages... No more visible option to hide the pages in the menu, no login option... Is it expected ?

@Japhys
Copy link
Author

Japhys commented Jan 22, 2021

I cannot get this to work. Bit of a problem, because I can't upgrade now :( Hidden nav items really should stay hidden in my case, not reappear after a refresh. Tested it with all lastest versions of core and plugins
@Ribero were you able to resolve this eventually?

@dfuentes87
Copy link

I seem to be having the same issue as Japhys, and just as he mentioned earlier disabling Caching fixes the issue.

dynamic_page_visibility and visibility_requires_access is set to true yet the page still shows up in the menu when not logged in. Mine is a clean install of Grav + admin with only user/pages being migrated over from a previous install.

Grav v1.7.3, Admin v1.10.2
CentOS 7
Apache 2.4.6
PHP 7.3-8.0 (tried on all of them)

@mahagr mahagr transferred this issue from getgrav/grav-plugin-login Jan 25, 2021
@mahagr mahagr added the fixed label Jan 25, 2021
@mahagr
Copy link
Member

mahagr commented Jan 25, 2021

I was able to figure out what was going on and fix the bug.

@Japhys
Copy link
Author

Japhys commented Jan 25, 2021

Good news! Thanks

@dfuentes87
Copy link

I manually made the changes in the commit and confirmed it works. Thank you.

@mahagr mahagr closed this as completed Feb 2, 2021
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

5 participants