Ticket #7690 (closed Bug: fixed)

Opened 7 years ago

Last modified 5 years ago

Enable Self Registration Flag in Security Control Panel broken with custom roles

Reported by: davidray Owned by: hannosch
Priority: major Milestone: 3.1
Component: General Version:
Keywords: Security Cc:

Description

For AddOn Products that add roles which come before 'Anonymous' in descending alpha order, the security panel flag does not properly work.

At present, the logic depends on 'Anonymous' being the first role name returned. This is a problem for AddOn Products that may have additional roles that fall before Anonymous alphabetically.

plone/app/controlpanel/security.py

Original:

    def get_enable_self_reg(self):
        app_perms = self.portal.rolesOfPermission(permission='Add portal member')
        for appperm in app_perms:
            if appperm['name'] == 'Anonymous' and \
               appperm['selected'] == 'SELECTED':
                return True
            else:
                return False

Working version:

    def get_enable_self_reg(self):
        app_perms = self.portal.rolesOfPermission(permission='Add portal member')
        for appperm in app_perms:
            if appperm['name'] == 'Anonymous' and \
               appperm['selected'] == 'SELECTED':
                return True
        return False

Change History

comment:1 Changed 7 years ago by hannosch

  • Owner changed from somebody to hannosch
  • Status changed from new to assigned

comment:2 Changed 6 years ago by hannosch

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [19978]) Enable self registration flag in security control panel was broken in some cases with custom roles. Patch provided by davidray, thx! This closes #7690.

comment:3 Changed 5 years ago by hannosch

  • Component changed from Control Panel to Infrastructure

comment:4 Changed 2 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.