Can't check for users permissions "Schedule content publication Allows users to set a start and end time for content publication"
After saving permissions it's again unchecked.

any idea?

Comments

istryker’s picture

Assigned: kale_ » Unassigned
Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

http://drupal.stackexchange.com/questions/130249/permissions-not-saving

This sounds a lot like a php runtime issue. PHP has a configuration called max_input_vars, which you can use to set a limit on the number of input vars php will accept. This will affect the number of $_POST and $_GET variables that can be fed into php. The default is 1000, and I suspect, if you have lots and lots of user type, you're hitting up against this ceiling.

Easy way to test is edit the permissions for a specific role. Usually that does not exceed 1000 checkbox. If it saves then the problem I quote is your problem.

If it is then please close this issue.

kale_’s picture

I've unchecked lots of checkboxes. No effect. Can't still check this permission.

istryker’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

If you are having problems with multiple checkboxes then the problem is Drupal/PHP settings. Not Scheduler module. Search for "Cannot save permissions in Drupal" on the internet. Closing issue.

jonathan1055’s picture

Title: Can't check permissions » Can't save permissions
Status: Closed (works as designed) » Active

Hi kale,
Did you manage to solve your problem? Maybe you have a large number of modules and many roles, thus creating a huge number of checkboxes in the form. Did you try editting the permissions just for a single role?

iStryker,
Thanks very much for your input. However, please may I request that you do not set the status to 'maintainer needs more info' when you are not actually a maintainer of this module. I do appreciate that you have good ideas and thank you for the link, but please do not close the issue before an actual maintainer has at least seen it and had a chance to contribute.

Cheers
Jonathan

kale_’s picture

But I can check other checkboxes. It's only about Permission for "Schedule content publication Allows users to set a start and end time for content publication"
I've checked and unchecked a huge amount of checkboxes. Every work fine.
I also change the php max input. Without result.
I do not have many roles (4) but have a lot of modules.

Anonymous’s picture

Sorry iStryker, same issue here on saving permissions for "Schedule content publication" only. Using Scheduler 7.x-1.3 and Drupal 7.38. Same result when using latest dev version.

I did already check my max_input_vars and related settings and the error remains when I use https://www.drupal.org/project/filter_perms for example.

jonathan1055’s picture

Title: Can't save permissions » Cannot save Scheduler permissions

Hi kale and moostdijk,
OK, you obviously have a problem, but I agree with iStryker that this is not specifically and solely a Scheduler bug. That permission works ok for me, so here are some things to try:

  1. We need to do is find out what is different in your environments. I presume you have a development or offline version of your site, so could you start by gradually disabling other modules and see if/when the scheduler permission becomes saveable.
  2. Can you confirm that the checkbox is tickable, but after clicking save, then you return the box is unticked again?
  3. Do you get the same behaviour for the other two Scheduler permissions "Administer scheduler" and "View scheduled content list"?
  4. Do you have the devel module installed? If so, I can help you to add some debug output to see where the checkbox value gets dropped.
Anonymous’s picture

StatusFileSize
new707 bytes

Hi jonathan1055,

Thanks for your prompt reply.

1. On the same server, I tried a clean 7.38 install. Then installed Scheduler and see "Schedule content publication" activated for the administrator role. Then when I check the box on this line, for "authenticated user" and then Save permissions, I see that nothing is saved and the checkbox for "administrator" is unchecked as well.

Furthermore, equal to kale, other permissions can be saved, both on my fully loaded site and on the clean install.

2. Yep, checkbox is tickable and after saving, the box is unticked.

3. No, only for "Schedule content publication", not for the other Scheduler access rights nor other permissions.

Did some more testing and the attached patch works for me.

jonathan1055’s picture

Thanks for the excellent feedback, and for your testing. Now we are really getting somewhere.

-    'schedule (un)publishing of nodes' => array(
+    'schedule publishing of nodes' => array(

So it seems there is a problem with punctuation in the permission machine name. That's fine, we can work round that and fix it. But interesting that it is not a problem on all sites. Maybe the php version affects it? or more likely the database engine. What database and version do you have? I wonder if those values are cleaned, either on saving to the role_permission table, or on retrieval.

Can you do your test again, without your patch, and look at the role_permission table for module='scheduler' after your clean install, and then after the first save (which fails to re-tick the permission). This is very good progress. Thanks.

Anonymous’s picture

On this server the PHP version is 5.5.21 and InnoDB engine (MySQL 5.5.41).

Values seem to be cleaned on save, see attached screenshots for the records in role_permission for %scheduler% on install and after checking "authenticated user" on the line of "Schedule content publication".

jonathan1055’s picture

Title: Cannot save Scheduler permissions » Cannot save Scheduler permission with ( ) in machine name key

Thanks for the screen shots. On the 'clean install' image it has all three scheduler permissions, but this does not seem right. After an initial install of a module there should be no permissions enabled. Also your table hae role 3, but the anonymous user I thought was role 1. Can you check that again, please? Or are you installing with a package or script which turns on some settings automatically?

At least this shows that the db table can accept the brackets in the text. So now we need to find out what is causing that row to be deleted at some later stage.

jonathan1055’s picture

Moostdijk,

At least this shows that the db table can accept the brackets in the text. So now we need to find out what is causing that row to be deleted at some later stage.

Did you do any more work on this? Can you try with a clean minimal D7 installation + Scheduler (without the patch from #8), and show us the db table rows.

Kale_,
Please could you tell us what PHP and database version you are using. Could you also try doing a clean minimal D7 install as described above, and show the scheduler rows in role_permission db table.

Thanks
Jonathan

Jordanmt’s picture

I've encountered the same issue, running Drupal 7.41 with PHP 5.6.15 and MySQL 5.0.11-dev and resolved it by removing the brackets as in #9. It's not my environment but I'll try and provide additional info if I can.

Jordanmt’s picture

StatusFileSize
new1.86 KB

The earlier workaround patch changes the machine name in hook_permission(), which made the permissions page functional but I still had the issue that the scheduling tab was not present on node editing pages where it ought to be.

This patch includes that change but also updates the access callback and node form alter to use the same machine name. I'm now seeing the scheduling tab.

jonathan1055’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Needs review

Hi Jordanmt,
Thanks for the patch. Yes, I realised when the patch in #8 was added, that it was not a sufficient change. However, I wanted to try to find out what was causing the problem, as clearly it only affects a small proportion of our users. So I had resisted fixing it straight away.

Thanks for the background info in #13. I am on D7.41, PHP 5.5.27 and MySQL 5.5.29 and cannot replicate it. Moostdijk in #6 had PHP 5.5.21, InnoDB MySQL 5.5.41 and did get the problem. So I'd be surprised if any of those were the cause.

You say that it's not your environment, so you probably cannot mess around with it too much, but could you tell us what other modules you have enabled? Or better still, if you have a dev site you can try on, progressively disable the modules and see which one finally makes the existing (unpatched) permissions work OK. Or maybe it is some combination of configuration settings?

Jonathan

The last submitted patch, 14: scheduler-permissionsave-2538002-14.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 8: scheduler-permissionsave-2538002-7.patch, failed testing.

jonathan1055’s picture

Status: Needs work » Needs review
StatusFileSize
new3.48 KB

Your patch did not update the .test file, hence all the failures. Also we need a hook_update to correct the existing permissions, which I have added.

We would need to fix this in 8.x first, but useful to have this patch here for now, given that there are some users who will need it.

jonathan1055’s picture

StatusFileSize
new4.14 KB

Added proper message at end of hook_update and also changed the text in README.txt so a search for the old permission name does not find anything. The readme is way out of date anyway, but that's another problem.

joekers’s picture

Status: Needs review » Needs work
StatusFileSize
new2.99 KB

Jonathan, not sure if you've started on the D8 version but here's a patch anyway.

I'll need to re-roll #2651448: Publish and Unpublish fields are shown for users who do not have the permission if this gets committed first as it checks this permission.

jonathan1055’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Needs work » Needs review

Great timing, I was just about to start, so thanks for this.
Tests manually and seems to be fine. Yes the patch in that other issue will have to be re-rolled.
Changed the version to 8.x to see how the tests run (should be the same as the branch - 13 pass, 5 fail)

Status: Needs review » Needs work

The last submitted patch, 20: cannot_save_scheduler-2538002-20.patch, failed testing.

jonathan1055’s picture

Component: Miscellaneous » Code
Status: Needs work » Needs review
StatusFileSize
new2.99 KB

Joe, we now know that changing the version to 8.x and status to 'needs review' allowed your patch in #20 to be tested, but it was tested at the issue version when that patch was uploaded. Here it is again, and this time it should be tested against 8.x. I have renamed it but not changed the content at all.

Status: Needs review » Needs work

The last submitted patch, 23: 2538002-23-clean_permission_name.d8.patch, failed testing.

  • jonathan1055 committed 41635c7 on 7.x-1.x
    Issue #2538002 by jonathan1055, moostdijk, Jordanmt, joekers: Cannot...
jonathan1055’s picture

Status: Needs work » Fixed

Committed to 8.x and 7.x. Even though we did not fully get to understand what caused the problem (as it was outside Scheduler) the fix was simple and reliable so I decided to go ahead anyway.
Thanks Joekers, moostdijk, jordanmt, kale_ and iStryker.

joekers’s picture

That's good to know about the tests running on the version number of the issue when the patch was submitted :) thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.