Grav: visibility_requires_access does not work in 1.7

Created on 16 Dec 2020  路  21Comments  路  Source: getgrav/grav

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?

1.7 bug fixed in repo

Most helpful comment

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

All 21 comments

@mahagr Were you able to reproduce this Matias?

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

@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.

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

@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.

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

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鈥櫭ヽran 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.

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".

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

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?

Thanks for trying.
Strange that you cannot replicate.

Version numbers are in my previous post

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.

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.

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

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...

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 ?

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?

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)

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

Good news! Thanks

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jens-t picture jens-t  路  18Comments

tmos picture tmos  路  21Comments

gizmecano picture gizmecano  路  17Comments

giansi picture giansi  路  17Comments

marktaylor46 picture marktaylor46  路  26Comments