def register_urlpatterns(self, urlpatterns): # Permissions section urlpatterns.namespace(r'^permissions/', 'permissions') # Roles urlpatterns.namespace(r'^users/', 'users', 'permissions') urlpatterns.patterns('permissions:users', url(r'^$', RolesList.as_view(), name='index'), url(r'^new/$', NewRole.as_view(), name='new'), url(r'^edit/(?P<pk>\d+)/$', EditRole.as_view(), name='edit'), url(r'^users/(?P<pk>\d+)/$', RoleUsers.as_view(), name='users'), url(r'^delete/(?P<pk>\d+)/$', DeleteRole.as_view(), name='delete'), )
def register_urlpatterns(self, urlpatterns): # Permissions section urlpatterns.namespace(r'^permissions/', 'permissions') # Roles urlpatterns.namespace(r'^users/', 'users', 'permissions') urlpatterns.patterns( 'permissions:users', url(r'^$', RolesList.as_view(), name='index'), url(r'^new/$', NewRole.as_view(), name='new'), url(r'^edit/(?P<pk>\d+)/$', EditRole.as_view(), name='edit'), url(r'^users/(?P<pk>\d+)/$', RoleUsers.as_view(), name='users'), url(r'^delete/(?P<pk>\d+)/$', DeleteRole.as_view(), name='delete'), )
RoleCategoryACL( role=target, category=form.category, category_role=form.cleaned_data['role'], )) if new_permissions: RoleCategoryACL.objects.bulk_create(new_permissions) acl_version.invalidate() message = _( "Category permissions for role %(name)s have been changed.") messages.success(request, message % {'name': target.name}) if 'stay' in request.POST: return redirect(request.path) else: return redirect(self.root_link) return self.render(request, { 'forms': forms, 'target': target, }) RolesList.add_item_action( name=_("Categories permissions"), icon='fa fa-comments-o', link='misago:admin:permissions:users:categories', style='success', )
new_permissions = [] for form in forms: if form.cleaned_data['role']: new_permissions.append( RoleForumACL(role=target, forum=form.forum, forum_role=form.cleaned_data['role'])) if new_permissions: RoleForumACL.objects.bulk_create(new_permissions) acl_version.invalidate() message = _("Forum permissions for role " "%(name)s have been changed.") messages.success(request, message % {'name': target.name}) if 'stay' in request.POST: return redirect(request.path) else: return redirect(self.root_link) return self.render(request, { 'forms': forms, 'target': target, }) RolesList.add_item_action(name=_("Forums permissions"), icon='fa fa-comments-o', link='misago:admin:permissions:users:forums', style='success')
RoleCategoryACL( role=target, category=form.category, category_role=form.cleaned_data['role'], ) ) if new_permissions: RoleCategoryACL.objects.bulk_create(new_permissions) acl_version.invalidate() message = _("Category permissions for role %(name)s have been changed.") messages.success(request, message % {'name': target.name}) if 'stay' in request.POST: return redirect(request.path) else: return redirect(self.root_link) return self.render(request, { 'forms': forms, 'target': target, }) RolesList.add_item_action( name=_("Categories permissions"), icon='fa fa-comments-o', link='misago:admin:permissions:users:categories', style='success', )
if form.cleaned_data['role']: new_permissions.append( RoleForumACL(role=target, forum=form.forum, forum_role=form.cleaned_data['role'])) if new_permissions: RoleForumACL.objects.bulk_create(new_permissions) acl_version.invalidate() message = _("Forum permissions for role " "%(name)s have been changed.") messages.success(request, message % {'name': target.name}) if 'stay' in request.POST: return redirect(request.path) else: return redirect(self.root_link) return self.render( request, { 'forms': forms, 'target': target, }) RolesList.add_item_action( name=_("Forums permissions"), icon='fa fa-comments-o', link='misago:admin:permissions:users:forums', style='success')