Needs work
Project:
Subuser
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Mar 2012 at 12:13 UTC
Updated:
21 Feb 2016 at 11:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
j4 commentedUse the tabtamer module http://drupal.org/project/tabtamer
Comment #2
marcusx commentedNo need for another module. You just change the view the comes with subuser. Change the "Tab" menue item into a "Normal" one.
Comment #3
bleg commentedI take it changing the view refers to version 6.x because it relied on views. Version 7 doesn't and the subusers tab is not a "view". I would have thought that the default behavior would be to not display the tab if the user's role does not permit them to have subusers. This doesn't seem to be the case.
Comment #4
lauriiiComment #5
bleg commentedNot sure if this is the best way to do it but this works.
Comment #6
LeoVe commentedThx bleg, it does work great !
Comment #7
kaizerking commented@bleg I think we should check if(module_exists('subuser') &&...
Comment #8
bleg commentedIn the code I gave in #5 it was checking for permission against the global user but it's better to check against the account. That way a user modifying a subuser can not add a subuser to that subuser.
Comment #9
shabam commentedI just noticed that the code was there and needs to be reviewed, so updating the status to needs review.
Comment #10
shabam commentedThere is a security problem here. The "view subuser" permission allows a user to view subusers for ALL users, not just the logged in user and their subusers. This should not be on for anyone but administrators. (I think I'll create a patch to change the wording on those).
Perhaps a new permission "view own subusers"?
Jason
Comment #11
shabam commentedI thunk on this one a bit. What we need is to see if the user has permission to create a subuser. If they do not, then they should not be seeing the list. The problem is that there can be any number of roles, which means any number of permissions to check for. So, I created a function,
that like the subuser_permissions function loops through and checks each role. This time instead of creating the permissions it checks to see if that permission is on for this user. Once the loop finds one that is on, it returns true (the user only needs one permission to be able to view the tab). If it never finds one, it returns false. If this logic is bad, let me know.
I then went into subuser_ui_access_list_page_callback,
which checks to see if the tab should be displayed. I then added a call to this permission function (bolded above).
Patch is attached
Jason
Comment #12
lauriiiI will take a look on this ASAP! Thanks for working on this!
Comment #13
shabam commentedDuplicate issue found and marked as duplicate at https://www.drupal.org/node/2444929
Comment #14
shabam commentedCame to check if this had been reviewed yet, and realized that the version was set wrong. My patch is based on the dev version.
Comment #15
LeoVe commentedWith the latest version of the Subuser module the patch in #5 now generates errors in the foreach statement.
Which is the best way to go now?
Thanks,
Leo
Comment #16
LeoVe commentedI entered patch #11 by hand in version 7.x-2.0-alpha4 and it seems to work. We'll do some extra testing and post the result.
thx !
Comment #17
nickonom commented#11 works for me. Will this be committed soon?
Comment #18
lauriiiI don't think the patch is 100% correct. Even though the user wouldn't be able to add subusers some other user could add the subusers. I think we need to add new permission that is "View own subusers" which will show that tab for users.
Comment #19
Snehal Brahmbhatt commentedHi Lauri,
Please find the attached patch "how_can_i_remove_the-1483590-19.patch"
Hope this works for you flawlessly!
Thanks,
Snehal Brahmbhatt | AddWeb Solution
https://www.drupal.org/user/3147795/track
Comment #20
Snehal Brahmbhatt commentedComment #21
lauriiiLooks good. We should still add test coverage for this so we don't break it in future.