Closed (fixed)
Project:
Permissions by Term
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Nov 2017 at 10:01 UTC
Updated:
24 Jun 2018 at 14:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kari.kaariainen commentedComment #3
jepster_Are you sure, that you have set any user or role limitations on the chosen taxonomy terms?
Are you getting any errors in the javascript console? Which browser are you using?
Comment #4
kari.kaariainen commentedYes, I'm sure that I have set everything correctly. The permissions work fine, just this block doesn't display what it is supposed to. On the older version 8.x-1.32 the block works OK.
I get this in Windows 10 Chrome devtools. I'm on node 1, hence property '1'.
jquery.min.js?v=3.2.1:2 jQuery.Deferred exception: Cannot read property '1' of undefined TypeError: Cannot read property '1' of undefined
at NodeForm.pushUserDisplayNames (https://dupo4.ply.st/sites/default/modules/permissions_by_term/js/node-f...)
at NodeForm.getPermissionsByTids (https://dupo4.ply.st/sites/default/modules/permissions_by_term/js/node-f...)
at NodeForm.renderPermissionsInfo (https://dupo4.ply.st/sites/default/modules/permissions_by_term/js/node-f...)
at NodeForm.displayPermissionsByAutocomplete (https://dupo4.ply.st/sites/default/modules/permissions_by_term/js/node-f...)
at initPermissionInfoByFormElements (https://dupo4.ply.st/sites/default/modules/permissions_by_term/js/node-f...)
at Object. (https://dupo4.ply.st/sites/default/modules/permissions_by_term/js/node-f...)
at i (https://dupo4.ply.st/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2:2...)
at fireWith (https://dupo4.ply.st/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2:2...)
at j (https://dupo4.ply.st/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2:3...)
at k (https://dupo4.ply.st/core/assets/vendor/jquery/jquery.min.js?v=3.2.1:2:3...) undefined
Comment #5
jepster_Sorry, I cannot reproduce this. For me it works like designed.
I have tried it on the simplytest.me service. The instance at https://duhmo.ply.st (u: admin - p: admin) - you can check it by yourself in the next ~23 hours. The Drupal instance is in German language, but you should be able to get the point by my screenshots below.
What have I did?:
1., Installed the PbT module in the latest release version 1.38.
2., Created a taxonomy term in the tags vocabulary. User: admin, roles: administrator.
3., Created and edited an article node and set the mentioned tags taxonomy term. In both cases the permissions info tab, in the node form, has been displayed correctly. See attached screenshots.
I am closing this issue. Please feel free to re-open, if you could provide step-by-step instructions (like above) and screenshots, to reproduce the problem in reasonable time.
Comment #6
kari.kaariainen commentedThe difference seems to be that you have set Allowed users to admin on the term edit page.
If the Allowed users is admin then:
Allowed users: admin
Allowed roles: Administrator
but if the Allowed users is empty then it's:
Allowed users: No user restrictions.
Allowed roles: No role restrictions. <----------- bug?
even if the role is still Administrator.
I assumed that you can set Allowed users OR Allowed roles OR both. Did I miss something?
Comment #7
jepster_I have tried to reproduce it again with a term, which has only a role restriction. I have tried with 1 and multiple roles on new and existing node edit. Sorry, I could not reproduce the problem again.
I have attached screenshots of my setup. Please make sure that you have not set anything wrong and feel free to re-open this issue again: if you have identified a way to reproduce the problem. You are welcome to describe your steps (that would be the best). E.g.
1., I am installing PbT in version 1.38 on simplytest.me.
2., I create a term with name "test" in the "tags" vocabulary
3., I am assigning the following permissions to this term: "user: admin" ....
4., ...
5., ...
Also a screenshot of the error message with the entire browser window with opened chrome dev tools would help! Please attach it.
I would really love to help you, but I currently can not.. :-/
Comment #8
jepster_Comment #9
kari.kaariainen commentedI reproduced the problem on your simplytest.me installation yesterday. It's odd that we don't see the same thing.
Anyway, here's how to reproduce. :
1. Install PbT 8.x-1.38 at simplytest.me
2. Enable Permissions by Term
3. Add a role "Restricted role"
4. Add a term "Restricted term" to Tags and set Allowed roles to "Restricted role" (leave Allowed users empty)
5. Add a field "Restricted field" to Basic page, keep the defaults (Type of item to reference: Taxomony term, Allowed number of values: Limited, 1)
6. At Reference type set Available Vocabularies to "Tags", keep other defaults (Reference method: Default, Create referenced entities if they don't already exist: unchecked)
7. Create Basic page, set Restricted field to Restricted term.
PERMISSIONS BY TERM
Allowed users: No user restrictions.
Allowed roles: No role restrictions. <--- should say Restricted term
8. Save the node, go edit the node, same result.
(Another problem: When editing the "Restricted term" I can set Allowed users to admin, but after saving when I go back to edit it, it's gone.)
Like I said, all this works fine on 8.x-1.32 minus the Ajax, obviously.
This is now available for 23 hours at https://duhcs.ply.st/user/login (admin:admin). If you have time to check, great, if not, I can set it up another time.
Comment #10
jepster_Thanks for the detailed description. Such a description helps a lot.
Now I see the problem on your simplytest.me instance. However, I do not see it on my local system. You are right: It's really odd, that it needed a few tries to reproduce. I will check the code which is mentioned in the error soon.
I will try to fix it soon. Thanks again.
For accountancy, the full error message (screenshot also attached):
js_hI3L8jxZjl718yHe3Hm4WLW8JaaiJTGmweNVkn1GCkM.js:2 jQuery.Deferred exception: Cannot read property '1' of undefined TypeError: Cannot read property '1' of undefined
at NodeForm.pushUserDisplayNames (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at NodeForm.getPermissionsByTids (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at NodeForm.renderPermissionsInfo (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at NodeForm.displayPermissionsByAutocomplete (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at initPermissionInfoByFormElements (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at Object. (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at i (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at fireWith (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at j (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...)
at k (https://duhcs.ply.st/sites/default/files/js/js_hI3L8jxZjl718yHe3Hm4WLW8J...) undefined
Comment #12
jepster_After I have installed PbT in an new database on my local machine, I could reproduce the issue and fix it. I could get the permissions info with or without a role. I have also checked a combination where user and role is set.
Please test the new release: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.39.
Please feel free to re-open this issue again, if you have any objections.
@kari.kaariainen: Thanks again for the issue reporting and assistance in reproduction! I hope PbT helps you in your projects.
Comment #13
jepster_Comment #14
kari.kaariainen commentedI'm sorry but I still have the exact same issue as before. I'm now on 8.x-1.43. Like before, the actual permissions are working fine.
Would you like me to set it up on simplytest.me again?
Comment #15
jepster_Yes, please.
Comment #16
jepster_Yes, please.
Comment #17
jepster_I could not reproduce this issue anymore. That's why I marked this issue as fixed after the patch with previous discussion. I thought you have tested it also on your end. :) Please provide a simplytest.me instance.
Comment #18
jepster_Please be so kind and assist. I cannot reproduce this currently. I will close this ticket, if there will be no action in the coming days. Please bear with me.
Comment #19
jepster_Closing again for no reply. Feel free to re-open, if you have any objections.
Comment #20
kari.kaariainen commentedThis is working now (8.x-1.52) when the widget is either "Autocomplete" or "Autocomplete (Tags style)" but doesn't work when the widget is either "Check boxes/radio buttons" or "Select list".
The widget can be configured on the "Manage form display" page, at for example admin/structure/types/manage/page/form-display.
Comment #21
nielsvoo commentedCorrect, i agree with "kari.kaariainen"
Please fix this in the production release, i've updated my site and was surprised by this new bug as it worked flawless until now.
See the print screens, my previous setting was indeed "Check boxes/radio buttons"
Thanks in advance
Nielsvoo
Comment #22
kari.kaariainen commentedComment #23
nielsvoo commentedOh sorry...
In addition to my last post. I'am not able to choose any "Autocomplete" items either, the AJAX indicator just keeps spinning.
I think there is some relation here, probably the items can't be found and therefore the "Autocomplete" option shows the preselected while the "Check boxes/radio buttons" option shows nothing.
Downgrading the module to 1.44 fixed the problem, also now i'am able to select items using the "Autocomplete" option.
Nielsvoo
Comment #24
nielsvoo commentedHi, i was wondering if there is any progress here yet?
Thanks,
Nielsvoo
Comment #25
jepster_The JavaScript components from PbT have been re-written and tested via QUnit and the Sinon testing framework. The fix is part of the latest version 8.x-1.54 release. I have been testing all taxonomy term entity reference form field types. All are working. The JavaScript code is much maintainable now.
Please test by own and feel free to re-open this issue (mind changing the status select field), if you have any objections.
Comment #26
jepster_