10000 Move 'Files' tab to position it under admin/content/media by markconroy · Pull Request #221 · localgovdrupal/localgov_core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Move 'Files' tab to position it under admin/content/media #221

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

Merged
merged 17 commits into from
Oct 15, 2024

Conversation

markconroy
Copy link
Member

Closes #220

Removes the permission to access the files overview permission. It's probably only developers that need this for debugging things, so we can add that manually when needed, or add it to the admin role (when we have one).

===
Thanks to Big Blue Door for sponsoring my time to work on this.

@markconroy markconroy requested review from ekes and stephen-cox May 23, 2024 14:00
Comment on lines 27 to 35
function _remove_access_files_overview_permission() {
$roles = Role::loadMultiple();
foreach ($roles as $role) {
if ($role->hasPermission('access files overview')) {
$role->revokePermission('access files overview');
$role->save();
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure of this, if there are custom roles that have been assigned this then they will get deleted. Sometimes it is useful if there are files which for what ever reason are not yet in media. I'd limit this to localgov drupal provided roles, and I'd check if they have been altered from default. Noting the update hook also runs this.

@stephen-cox
Copy link
Member

As @andybroomfield points out - there are potential issues removing this permission for existing sites. Maybe just remove the update hook. We could always add a release note suggesting existing sites do this manually if it's important.

@finnlewis
Copy link
Member

Just discussing in Merge Tuesday.

Generally happy to remove the permission for fresh installs.

However, deploying an update hook that removes permissions from existing roles is perhaps a bit too far.

Perhaps we should remove the permission in the default install, and add instructions for people to clarify that they can remove the permission for certain roles.

@finnlewis
Copy link
Member

Note: would like to check where the permission 'access files overview' is being set to see if we can remove it there rather than here.

Copy link
Member
@stephen-cox stephen-cox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's been some discussion on #220 on how desirable this actually is. At least one person finds the files list useful, but it's also needed to ensure a file has been deleted.

If we go ahead and merge this we need to at least document how to get it back should it be needed.

@markconroy
Copy link
Member Author

Maybe we could have the best of both worlds.

  1. Remove the files menu link from the admin/content page
  2. Add the files menu link to the tabs on the admin/content/media page

That would mean people can still get to the files tab, but don't mistake if for the media tab which is what they usually want. It might make more sense to go to "Admin > Content > Media > Files" for content editors, as then it looks like files are a sub-item of media items (which they are).

@ekes
Copy link
Member
ekes commented Aug 6, 2024

MT: moving the link sounds more promising than removing permission;
maybe check with @willguv or product group about moving it being good.

Are there files being used that aren't in media?

@finnlewis
Copy link
Member

Note: @willguv is away for a few weeks, so might want to park this until he's back.

@finnlewis
Copy link
Member

@willguv likes the sound of @markconroy's suggestion!

@markconroy
Copy link
Member Author

I've rewritten this PR. New version:

  1. Adds the views.view.files.yml view to our config/install so new sites can use it.
  2. Adds a local task for the Files tab to sit under 'Media' on the /admin/content/* pages
  3. Adds an update hook to update current sites to move 'Files' from admin/content/files to admin/content/media/files

Thanks to Big Blue Door for sponsoring my time to work on this.

@markconroy markconroy changed the title removes access files overview permission Move 'Files' tab to position it under admin/content/media Sep 2, 2024
Copy link
Member
@stephen-cox stephen-cox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this and it works, I do have a couple of comments though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be moving the files tab for existing installs. The new location isn't very obvious and will be confusing to people who are using files already.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the update hook now, however given that we are creating a localgov_core.links.task.yml file, we will now have a 'Files' tab on the admin/content page and also on the admin/content/media page.

Maybe that's okay, and existing sites can update the view manually if they want to remove the tab from the admin/content page.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a little oddity here for existing installs as going to the files listing now looks like this

image

Let's discuss as a Merge Tuesday as to how much if an issue it is.

I also note that Files appears under Content in the menu and where perhaps it should under Content > Media. But if this is a problem then it could be another issue.

@finnlewis
Copy link
Member

@willguv we're discussing this in Merge Tuesday and not sure of the motivation for moving the files tab.

Could we discuss with content and product people?

Files and media entities are different things, and there are use cases for accessing both.

We could perhaps address this with a how-to or other documentation?

@markconroy
Copy link
Member Author

@finnlewis Will stated at product group meeting today that we should just create an update hook to remove the tab from admin/content and write a release note to say where the files tab has been moved to.

#220 (comment)

@finnlewis finnlewis merged commit 3795544 into 2.x Oct 15, 2024
8 checks passed
@ekes
Copy link
Member
ekes commented May 13, 2025

referencing #283 follow-up for why this is done, and potentially reviewing how this is done.

ekes added a commit that referenced this pull request May 13, 2025
… menu.

Note: This is opinionated administration configuration that probably
shouldn't be enforced on users just requiring core or media. It probably
wants to live somewhere else.
ekes added a commit that referenced this pull request May 13, 2025
The view is supplied by localgov_media so creating the link here too.
Probably wants to be in some other LocalGov Admin configuration module
really.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide the 'files' tab to non admins
5 participants
0