You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title suggests, the "get_user_permission_level" function in cms.utils.permissions tries to return the level of the page and falls over with an AttributeError. I don't think this is something that I have messed up (I am adding the CMS to an existing project that was on django 1.5, upgrading to django 1.8.8 in the process so I have to contend with the new migrations).
This is using version 3.2.0 and occurs on line 202.
I think that is is just a case of changing .level to .get_depth() but I don't know what knock on effects this will have.
Furthermore there are two lookups for __level in get_subordinate_users() and get_subordinate_groups() in the same file. (Let me know if you need new tickets raising for these)
defget_user_permission_level(user):
""" Returns highest user level from the page/permission hierarchy on which user haves can_change_permission. Also takes look into user groups. Higher level equals to lover number. Users on top of hierarchy have level 0. Level is the same like page.level attribute. Example: A,W level 0 / \ user B,GroupE level 1 / \ C,X D,Y,W level 2 Users A, W have user level 0. GroupE and all his users have user level 1 If user D is a member of GroupE, his user level will be 1, otherwise is 2. """if (user.is_superuserorGlobalPagePermission.objects.with_can_change_permissions(user).exists()):
# thosereturn0try:
permission=PagePermission.objects.with_can_change_permissions(user).order_by('page__path')[0]
exceptIndexError:
# user isn't assigned to any noderaiseNoPermissionsExceptionreturnpermission.page.level#<----OFFENDING LINE
The text was updated successfully, but these errors were encountered:
I just bumped into this. Treebeard MP_Node has a "depth" attribute, so it looks like the fix is to simply replace level with depth. What I can't understand is how this has escaped fixing all this time, and I see new code in develop that still references "level." Am I missing something?
The level attribute is also referenced in some templates, possibly elsewhere. I can provide a PR if someone can confirm that this hasn't been fixed some other way.
As the title suggests, the "get_user_permission_level" function in cms.utils.permissions tries to return the level of the page and falls over with an AttributeError. I don't think this is something that I have messed up (I am adding the CMS to an existing project that was on django 1.5, upgrading to django 1.8.8 in the process so I have to contend with the new migrations).
This is using version 3.2.0 and occurs on line 202.
I think that is is just a case of changing .level to .get_depth() but I don't know what knock on effects this will have.
Furthermore there are two lookups for __level in get_subordinate_users() and get_subordinate_groups() in the same file. (Let me know if you need new tickets raising for these)
The text was updated successfully, but these errors were encountered: