Comments

kari.kaariainen created an issue. See original summary.

kari.kaariainen’s picture

Issue summary: View changes
jepster_’s picture

Status: Active » Postponed (maintainer needs more info)

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?

kari.kaariainen’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

Yes, 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

jepster_’s picture

Status: Active » Closed (works as designed)
StatusFileSize
new161.36 KB
new172.9 KB
new104.44 KB

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.

kari.kaariainen’s picture

Status: Closed (works as designed) » Active

The 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?

jepster_’s picture

StatusFileSize
new172.22 KB
new148.73 KB
new105.15 KB

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.. :-/

Term permission settings

New node form

Existing node form

jepster_’s picture

Status: Active » Closed (cannot reproduce)
kari.kaariainen’s picture

Status: Closed (cannot reproduce) » Active
StatusFileSize
new14.93 KB
new40.52 KB

I 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.

Only local images are allowed.

Only local images are allowed.

jepster_’s picture

Status: Active » Needs work
StatusFileSize
new260.54 KB

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

  • Peter Majmesku committed 06a8f42 on 8.x-1.x
    Issue #2924884 by Peter Majmesku, kari.kaariainen: Permissions info is...
jepster_’s picture

Status: Needs work » Fixed

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.

jepster_’s picture

Status: Fixed » Closed (fixed)
kari.kaariainen’s picture

I'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?

jepster_’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

Yes, please.

jepster_’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

Yes, please.

jepster_’s picture

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.

jepster_’s picture

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.

jepster_’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing again for no reply. Feel free to re-open, if you have any objections.

kari.kaariainen’s picture

This 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.

nielsvoo’s picture

Correct, 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

kari.kaariainen’s picture

Status: Closed (cannot reproduce) » Active
nielsvoo’s picture

Oh 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

nielsvoo’s picture

Hi, i was wondering if there is any progress here yet?

Thanks,
Nielsvoo

jepster_’s picture

Status: Active » Fixed

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.

jepster_’s picture

Status: Fixed » Closed (fixed)