Closed (fixed)
Project:
Icon API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Aug 2013 at 16:15 UTC
Updated:
28 Apr 2014 at 22:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
systemick commentedI've created a patch for this issue
Comment #2
dw72 commentedWorks ok with patch #1
Comment #3
dw72 commentedThis is no feature request, this is bug in permissions.
Comment #4
markhalliwellI'm almost tempted to mark this as "closed (works as designed)". The purpose behind granting full access to view the icons is anyone should be able to at least view the icons (ie: say you want to provide documentation to end users and point them to the link that shows them what icons are available).
Other submodules (ie: icon_block, icon_menu) have additional permissions that give you the ability to limit the editing of the icons. I'm not entirely sure what it is you want me to do here.
PS, this is a feature, not a bug (for reasons stated above).
Comment #5
dw72 commentedWithout this patch authenticated users have rights to disable icons bundle or edit and delete it... not only view icons. This must be corrected with this or other way... maybe you need to split this to 'view icons' and 'edit icons' permissions.
Comment #6
markhalliwellAh, well in that case this is a bug after all then. However, the edit and delete links/callbacks are what need the permission then, not the overview form. So the issue/patch needs to reflect that.
Comment #7
dw72 commentedYes after your explanation patch must be changed...
Comment #8
dw72 commentedPlease check this patch, I think it is working ok, but i'm not too familiar with drupal permission and forms building system and may do some mistakes.
Comment #9
markhalliwellI would rather just not show the checkbox instead. Users could open the inspector and just remove the "disabled" attribute and then (in theory) submit the form (which should also be restricted in the form_submit hook).
Just wrap the entire thing in a user_access check. Don't break the logic of the elseif.
Comment #10
dw72 commentedNext try. Removed checkboxes, and not showing disabled icon bundles for users without admin permissions. Please review.
Comment #11
dw72 commentedAnd?
Comment #12
geodaniel commentedI'd say that the icon administration pages shouldn't be visible to people who don't have the 'administer icons' permission.
For example, if I have roles for different levels of administrators (e.g. site administrator, limited administrator), I want to give the limited administrator access to only the things they really need. With most other modules, removing the 'administer [x]' permission will hide the whole menu item for that role rather than just restricting content in it.
That said, I can understand why you want to have it accessible, so perhaps you could add a 'view icon administration' permission as well as the 'administer icons' permission?
Comment #13
geodaniel commentedThe attached patch combines dw72's patch from #10 and my ideas from #12. An admin can now be given a 'View Icon Information' permission to just view the icons, and can also be given an 'Administer Icons' permission to have the extra control to be able to enable or disable icons, or access other configuration.
Comment #14
geodaniel commentedUpdated patch which includes form validation handlers to ensure the user has the 'administer icons' permission.
Comment #15
Anonymous (not verified) commentedEither I'm doing something wrong or this patch doesn't actually do anything to the user permissions settings. Ran it, problem with non-admin(custom roles) being able to access Icon config settings persists.
Comment #16
drupov commentedJust confirming that the patch from #14 adds the necessary "View Icon Information" permission, which hides the icon information from the roles that do not have it.
The patch was applied against the latest dev of the module (2013-Sep-30).
Thanks!
Comment #17
markhalliwellThanks guys!
I normally would have given commit attribution, but I had to rework a lot of that patch. Plus I went ahead and added a new feature that let's you set a "path alias" for users with the "view icons" permission. This way it will keep the back end (URL wise) separate.
Committed 76b02fe to 7.x-1.x.
Comment #18
markhalliwellCommitted b2b4346 to 7.x-1.x.
Comment #19
drupov commentedHi, I have a problem with that one:
granting a user role the "View Icons"-permission gives him the ability to see the URL /icons (or whatever you specify). There he sees the table with the enabled bundles and each row has under Operations only a "View icons"-link. So far so good.
But without the "Administer Icons"-permissions this role cannot access the URL, where the icons for any bundle are listed, e.g. /admin/config/media/icon/bundle/my_bundle ("Access denied"). In fact the "View Icons"-link is something like "icons/my_bundle".
Comment #20
drupov commentedComment #21
markhalliwellCorrect. That is exactly how it's supposed to work. The point of a "view icons" permission (separate from "administer icons") is to create a clear distinction between those who can simply "view" and those who can "administer". The path starts with /admin after all, they shouldn't be going there.
Comment #22
drupov commentedThanks for the quick reply. #21 clarifies this.
I just discovered that the path /icons/my_bundle does work on my Ubuntu development machine when I have no Virtual Host entry for the site, e.g. localhost/drupal_icons/icons/my_bundle.
If I use a VH entry I get a Apache "Not Found" error on drupal_icons.local/icons/my_bundle. The same on the site I develop right now, as well as on the fresh drupal install I am testing icon on.
Does it have something to do with the fact that icons is an aliased path?
Comment #23
markhalliwellI run an nginx stack and I'm not seeing this at all. I am seeing it on http://sff120b8134c72a7.s3.simplytest.me/icons/lullacons_pack1. However, when I prepend it with non-clean url query parameter it works: http://sff120b8134c72a7.s3.simplytest.me/?q=icons/lullacons_pack1
I did a little googling and it turns out Apache appears to have an aliases "/icons" path turned on by default:
http://stackoverflow.com/questions/12110693/removal-of-the-var-www-icons...
So the solution is to rename your path alias or just remove that from your configuration.
Comment #24
drupov commentedThanks!
On my Ubuntu machine this settings are written in /etc/apache2/mods-available/alias.conf. I commented them and the /icons/my-bundle path worked.
I have two questions though - and I am happy to buy you beers when we meet, promised :)
1) Isn't is better for the icon module to provide a different default path alias for that page, in order to not conflict with the apache settings?
2) Connected to 1) and probably a bug for this issue - I can change the alias in the icons settings at under "Global settings" at admin/config/media/icon since beta4, which is very cool, but the "View Icons"-link isn't updated. E.g. if I change the View Path Alias to "site-icons" the "View Icons"-link still says "/icons/my_bundle" and not "/site-icons/my-bundle"
Comment #25
markhalliwell1) I really don't want to change it, plus it would stop the confusion of other that would also think of such a simple path. So I've committed a warning message: https://drupal.org/comment/8491313#comment-8491313 that only shows up for apache servers and when the path is "icons". The message can also be suppressed.
2) Fixed with https://drupal.org/comment/8491327#comment-8491327
PS, please create new issues for actual bugs. It helps keep track of them instead of in comments.
Comment #26
markhalliwellAlso, fwiw, I've created 7.x-1.0-beta5 with all these changes (mainly because of the ZIP archive issue with fontello):
https://drupal.org/node/2198473