|
@@ -5,12 +5,13 @@ from misago.forms import YesNoSwitch
|
|
|
|
|
|
def make_form(request, role, form):
|
|
def make_form(request, role, form):
|
|
if not role.special and request.user.is_god():
|
|
if not role.special and request.user.is_god():
|
|
- form.base_fields['can_use_acp'] = forms.BooleanField(widget=YesNoSwitch, initial=False, required=False)
|
|
|
|
form.base_fields['can_use_mcp'] = forms.BooleanField(widget=YesNoSwitch, initial=False, required=False)
|
|
form.base_fields['can_use_mcp'] = forms.BooleanField(widget=YesNoSwitch, initial=False, required=False)
|
|
- form.layout.append((
|
|
|
|
- _("Special Access"),
|
|
|
|
- (('can_use_mcp', {'label': _("Can use Moderator Control Panel"), 'help_text': _("Change this permission to yes to grant access to Mod CP for users with this role.")}),),
|
|
|
|
- (('can_use_acp', {'label': _("Can use Admin Control Panel"), 'help_text': _("Change this permission to yes to grant admin access for users with this role.")}),),
|
|
|
|
|
|
+ form.base_fields['can_use_acp'] = forms.BooleanField(widget=YesNoSwitch, initial=False, required=False)
|
|
|
|
+ form.layout.append((_("Special Access"),
|
|
|
|
+ (
|
|
|
|
+ ('can_use_mcp', {'label': _("Can use Moderator Control Panel"), 'help_text': _("Change this permission to yes to grant access to Mod CP for users with this role.")}),
|
|
|
|
+ ('can_use_acp', {'label': _("Can use Admin Control Panel"), 'help_text': _("Change this permission to yes to grant admin access for users with this role.")}),
|
|
|
|
+ )
|
|
))
|
|
))
|
|
|
|
|
|
|
|
|
|
@@ -28,11 +29,13 @@ def build(acl, roles):
|
|
acl.special.acl['can_use_mcp'] = False
|
|
acl.special.acl['can_use_mcp'] = False
|
|
|
|
|
|
for role in roles:
|
|
for role in roles:
|
|
- if 'can_use_acp' in role:
|
|
|
|
- acl.special.acl['can_use_acp'] = True
|
|
|
|
- acl.special.acl['can_use_mcp'] = True
|
|
|
|
- elif 'can_use_mcp' in role:
|
|
|
|
- acl.special.acl['can_use_mcp'] = True
|
|
|
|
|
|
+ try:
|
|
|
|
+ if role['can_use_acp']:
|
|
|
|
+ acl.special.acl['can_use_acp'] = True
|
|
|
|
+ if 'can_use_mcp' in role and role['can_use_mcp']:
|
|
|
|
+ acl.special.acl['can_use_mcp'] = True
|
|
|
|
+ except KeyError:
|
|
|
|
+ pass
|
|
|
|
|
|
if acl.special.acl['can_use_acp'] or acl.special.acl['can_use_mcp']:
|
|
if acl.special.acl['can_use_acp'] or acl.special.acl['can_use_mcp']:
|
|
acl.team = True
|
|
acl.team = True
|