def manage_access(request, project): """User management view.""" obj = get_project(request, project) if not can_manage_acl(request.user, obj): raise PermissionDenied() return render( request, 'manage-access.html', { 'object': obj, 'project': obj, 'groups': obj.all_groups(), 'add_user_form': UserManageForm(), })
def manage_access(request, project): """User management view.""" obj = get_project(request, project) if not can_manage_acl(request.user, obj): raise PermissionDenied() return render( request, 'manage-access.html', { 'object': obj, 'project': obj, 'groups': obj.all_groups(), 'add_user_form': UserManageForm(), } )
def check_user_form(request, project, verbose=False): """Check project permission and UserManageForm. This is simple helper to perform needed validation for all user management views. """ obj = get_project(request, project) if not can_manage_acl(request.user, obj): raise PermissionDenied() form = UserManageForm(request.POST) if form.is_valid(): return obj, form elif verbose: for error in form.errors: for message in form.errors[error]: messages.error(request, message) return obj, None
def check_user_form(request, project, verbose=False): """Check project permission and UserManageForm. This is simple helper to perform needed validation for all user management views. """ obj = get_project(request, project) if not can_manage_acl(request.user, obj): raise PermissionDenied() form = UserManageForm(request.POST) if form.is_valid(): return obj, form elif verbose: for error in form.errors: for message in form.errors[error]: messages.error(request, message) return obj, None
def manage_access(request, project): """User management view.""" obj = get_project(request, project) if not can_manage_acl(request.user, obj): raise PermissionDenied() if can_edit_access_control(request.user, obj): access_form = ProjectAccessForm(instance=obj) else: access_form = DisabledProjectAccessForm(instance=obj) return render( request, 'manage-access.html', { 'object': obj, 'project': obj, 'groups': obj.all_groups(), 'add_user_form': UserManageForm(), 'access_form': access_form, })