Project

General

Profile

Actions

Bug #5502

open

500 error when using multiple custom branch permissions

Added by Frank Ecsedy over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
High
Assignee:
-
Category:
-
Target version:
Start date:
25.10.2018
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

We created 4 branch patterns with priorities 10, 20, 30 and 40. I created a new group that has force push permissions on those branches. When I add a user to the new group and try to view their permissions it is either wrong (no extra permissions show) or it throws a 500. Here is the exception log:

Traceback (most recent call last):
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/tweens.py", line 39, in excview_tween
response = handler(request)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/router.py", line 156, in handle_request
view_name
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/view.py", line 642, in call_view
response = view_callable(context, request)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/viewderivers.py", line 390, in attr_view
return view(context, request)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/viewderivers.py", line 368, in predicate_wrapper
return view(context, request)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/viewderivers.py", line 462, in rendered_view
request, result, view_inst, context)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/renderers.py", line 435, in render_view
return self.render_to_response(response, system, request=request)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/renderers.py", line 458, in render_to_response
result = self.render(value, system_values, request=request)
File "/opt/rhodecode/store/mxgf7jxv7p2nw91a4y9c89y8jia712g5-python2.7-pyramid-1.9.2/lib/python2.7/site-packages/pyramid/renderers.py", line 454, in render
result = renderer(value, system_values)
File "/opt/rhodecode/store/86qd4x71plpan4xz807ng3g09hcc2l3p-python2.7-pyramid-mako-1.0.2/lib/python2.7/site-packages/pyramid_mako/
init.py", line 156, in __call_
reraise(MakoRenderingException(errtext), None, exc_info[2])
File "/opt/rhodecode/store/86qd4x71plpan4xz807ng3g09hcc2l3p-python2.7-pyramid-mako-1.0.2/lib/python2.7/site-packages/pyramid_mako/init.py", line 148, in call
result = template.render_unicode(*system)
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/template.py", line 471, in render_unicode
as_unicode=True)
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 838, in _render
*
kwargs_for_callable(callable, data))
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 873, in render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 899, in _exec_template
callable
(context, *args, **kwargs)
File "base_root_mako", line 99, in render_body
File "_base_base_mako", line 54, in render_body
File "rhodecode_templates_admin_users_user_edit_mako", line 133, in render_main
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 761, in _include_file
callable
(ctx, **kwargs)
File "admin_users_user_edit_perms_summary_mako", line 35, in render_body
File "/opt/rhodecode/store/rq6n4kdw9z8d44km9njnr5rxxyh01p4h-python2.7-zope.cachedescriptors-4.3.1/lib/python2.7/site-packages/zope/cachedescriptors/property.py", line 106, in __get
_
value = func(inst)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1076, in permissions_full_details
user=self, cache=None, calculate_super_admin=True)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1211, in get_perms
calculate_super_admin)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/rc_cache/utils.py", line 79, in decorate
return self.get_or_create(key, creator, timeout, should_cache_fn)
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/cache/region.py", line 864, in get_or_create
async_creator) as value:
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/lock.py", line 186, in enter
return self._enter()
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/lock.py", line 93, in _enter
generated = self._enter_create(value, createdtime)
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/lock.py", line 179, in _enter_create
return self.creator()
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/cache/region.py", line 831, in gen_value
created_value = creator()
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/rc_cache/utils.py", line 71, in creator
return fn(*arg, **kw)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1205, in compute_perm_tree
explicit, algo, calculate_super_admin)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 320, in _cached_perms_data
return permissions.calculate()
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 450, in calculate
self._calculate_repository_branch_permissions()
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 789, in _calculate_repository_branch_permissions
p = self._choose_permission(p, cur_perm)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 942, in _choose_permission
cur_perm_val = Permission.PERM_WEIGHTS[cur_perm]
MakoRenderingException:

Traceback (most recent call last):
File "/opt/rhodecode/store/86qd4x71plpan4xz807ng3g09hcc2l3p-python2.7-pyramid-mako-1.0.2/lib/python2.7/site-packages/pyramid_mako/init.py", line 148, in call
result = template.render_unicode(*system)
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/template.py", line 471, in render_unicode
as_unicode=True)
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 838, in _render
*
kwargs_for_callable(callable, data))
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 873, in render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 899, in _exec_template
callable
(context, *args, **kwargs)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/templates/base/root.mako", line 156, in render_body
${next.body()}
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/templates/base/base.mako", line 32, in render_body
${next.main()}
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/templates/admin/users/user_edit.mako", line 53, in render_main
<%include file="/admin/users/user_edit_${c.active}.mako"/>
File "/opt/rhodecode/store/ida848f1ziml06glki8mawhi38h2k4fv-python2.7-mako-1.0.7/lib/python2.7/site-packages/mako/runtime.py", line 761, in include_file
callable
(ctx, **kwargs)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/templates/admin/users/user_edit_perms_summary.mako", line 3, in render_body
${p.perms_summary(c.perm_user.permissions_full_details, show_all=True, side_link=h.route_path('edit_user_perms_summary_json', user_id=c.user.user_id))}
File "/opt/rhodecode/store/rq6n4kdw9z8d44km9njnr5rxxyh01p4h-python2.7-zope.cachedescriptors-4.3.1/lib/python2.7/site-packages/zope/cachedescriptors/property.py", line 106, in get
value = func(inst)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1076, in permissions_full_details
user=self, cache=None, calculate_super_admin=True)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1211, in get_perms
calculate_super_admin)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/rc_cache/utils.py", line 79, in decorate
return self.get_or_create(key, creator, timeout, should_cache_fn)
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/cache/region.py", line 864, in get_or_create
async_creator) as value:
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/lock.py", line 186, in enter
return self._enter()
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/lock.py", line 93, in _enter
generated = self._enter_create(value, createdtime)
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/lock.py", line 179, in _enter_create
return self.creator()
File "/opt/rhodecode/store/v33y23yxrp8sa4l232vf4i5nmwnclili-python2.7-dogpile.cache-0.6.6/lib/python2.7/site-packages/dogpile/cache/region.py", line 831, in gen_value
created_value = creator()
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/rc_cache/utils.py", line 71, in creator
return fn(*arg, **kw)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 1205, in compute_perm_tree
explicit, algo, calculate_super_admin)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 320, in _cached_perms_data
return permissions.calculate()
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 450, in calculate
self._calculate_repository_branch_permissions()
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 789, in _calculate_repository_branch_permissions
p = self._choose_permission(p, cur_perm)
File "/opt/rhodecode/store/rn12s997k08lbfzg074fca3x206ng6si-python2.7-rhodecode-enterprise-ce-4.13.3/lib/python2.7/site-packages/rhodecode/lib/auth.py", line 942, in _choose_permission
cur_perm_val = Permission.PERM_WEIGHTS[cur_perm]
TypeError: unhashable type: 'OrderedDict'


Files

permission_tree_patch.diff (11.1 KB) permission_tree_patch.diff Daniel D, 25.10.2018 20:27
Actions #1

Updated by Marcin Kuzminski [CTO] over 5 years ago

  • Status changed from New to In Progress
  • Priority changed from Normal to High
  • Target version set to v4.14

Seems we're hitting some odd bug with displaying the permissions tree for members of user groups.

I guess it has to do something with multiple patterns.

Q: Do we make a bugfix or add this to 4.14 ?

Actions #2

Updated by Daniel D over 5 years ago

We have a fix for that. This is only for display of permissions inheritance chain.

@Frank, do you want a patch for that on your instance, or would you wait for the next release that addresses this issue?

Best

Actions #3

Updated by Frank Ecsedy over 5 years ago

A patch would be best right now. Thanks.

Actions #4

Updated by Daniel D over 5 years ago

Frank -

Please find below a patch file to apply on top of 4.13.X release.
This patch adds a new flush of caches when user group permissions are changed, as well as fixes the display issues
with permission summary on multiple branch entries.

It's a plaintext patch so you can review it before applying.

Below are the instructions on how it should be applied.

# Instructions on how to apply a patch into an instance

# for EE
cd .rccontrol/enterprise-1/profile/etc/rhodecode_enterprise_ce_source/lib/python2.7/site-packages

# a) copy over the `patch_file_name.diff` into that location
# b) check if patch applies correctly
# c) there should be no failed hunks during the --dry-run operation
# d) if patch applies clean, and no failed hunks are displayed, proceed with executing without --dry-run.

patch -p1 --dry-run -i patch_file_name.diff

patch -p1 -i patch_file_name.diff

# e) finally all the files that were modified during patching 
#    needs their .pyc cached version removed.
#    e.g
#
#    patching file rhodecode/lib/vcs/backends/base.py
#    ...
#    so we need to remove
#    rm rhodecode/lib/vcs/backends/base.pyc

# After the patch is applied a restart of rhodecode is mandatory to pick up patched changes
rccontrol restart "*"

# in case of any problems, patches can be removed by doing.
# rccontrol upgrade --force --version=X.Y.Z
# e.g rccontrol upgrade --force --version 4.10.6 enterprise-1
# where X.Y.Z is your RhodeCode Version, e.g 4.10.6
# Patches also are reverted during upgrade to different version e.g from 4.10.6 to 4.10.7
Actions #5

Updated by Frank Ecsedy over 5 years ago

The patch was successful and the permissions now display correctly.

Actions #6

Updated by Redmine Integration over 5 years ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF