Open klonos opened 3 years ago
Turns out that this is very simple to implement after all, with relatively minimal changes:
user_requirements()
hook, to show the warning in the status report. Here's what it looks like on my local:
'deprecated'
key in the definition array for permissions + add some logic around it. This pretty much works the same way as the existing 'restrict access'
key, which adds the Warning: Give to trusted roles only;
indication in the Permissions page. Here's what it looks like on my local:
The hook_requirements()
thing is fine to implement on top of the current 1.x code, but the deprecation logic and the display of the warning in the Permissions page needs to happen in user_admin_permissions()
and there is duplication of that code all over the place that we'd better clean up first. See: #5031.
...another thing that we could implement for additional DX++ is logging a watchdog message each time a deprecated permission is checked via user_access()
.
Waiting on #5031 before I resume work on this - in the meantime, I did push the code from my local (which includes the changes from the PR for #5031), so that we can get a sandbox going, and see if there are any obvious things to fix (coding standards, spelling/typos etc.).
Issues like #3787 and #4487 were the triggers for this issue here.
Our Drupal brethren started implementing this and were originally planning to add it in Drupal 8.5.0: