def object_log(request, cluster_slug, instance, rest=False): """ Display all of the Users of a VirtualMachine """ cluster = get_object_or_404(Cluster, slug=cluster_slug) vm = get_object_or_404(VirtualMachine, hostname=instance) user = request.user if not (user.is_superuser or user.has_perm('admin', vm) or user.has_perm('admin', cluster)): raise Http403(NO_PRIVS) if rest: return list_for_object(request, vm, True) else: return list_for_object(request, vm)
def object_log(request, cluster_slug): """ displays object log for this cluster """ cluster = get_object_or_404(Cluster, slug=cluster_slug) user = request.user if not (user.is_superuser or user.has_perm('admin', cluster)): raise PermissionDenied(NO_PRIVS) return list_for_object(request, cluster)
def object_log(request, cluster_slug): """ displays object log for this cluster """ cluster = get_object_or_404(Cluster, slug=cluster_slug) user = request.user if not (user.is_superuser or user.has_perm('admin', cluster)): return render_403(request, "You do not have sufficient privileges") return list_for_object(request, cluster)
def object_log(request, cluster_slug, instance, rest=False): """ Display all of the Users of a VirtualMachine """ cluster = get_object_or_404(Cluster, slug=cluster_slug) vm = get_object_or_404(VirtualMachine, hostname=instance) user = request.user if not (user.is_superuser or user.has_perm('admin', vm) or user.has_perm('admin', cluster)): return render_403(request, _("You do not have sufficient privileges")) if not rest: return list_for_object(request, vm) else: return list_for_object(request, vm, True)
def object_log(request, cluster_slug, host): """ Display object log for this node """ cluster = get_object_or_404(Cluster, slug=cluster_slug) node = get_object_or_404(Node, hostname=host) user = request.user if not (user.is_superuser or user.has_any_perms(cluster, ['admin','migrate'])): return render_403(request, "You do not have sufficient privileges") return list_for_object(request, node)
def object_log(request, cluster_slug, host, rest=False): """ Display object log for this node """ node, cluster = get_node_and_cluster_or_404(cluster_slug, host) user = request.user if not (user.is_superuser or user.has_any_perms(cluster, ['admin','migrate'])): if not rest: raise Http403(NO_PRIVS) else: return {'error': NO_PRIVS} return list_for_object(request, node, rest)
def object_log(request, cluster_slug, host, rest=False): """ Display object log for this node """ node, cluster = get_node_and_cluster_or_404(cluster_slug, host) user = request.user if not (user.is_superuser or user.has_any_perms(cluster, ['admin','migrate'])): if not rest: return render_403(request, _("You do not have sufficient privileges")) else: return {'error':'You do not have sufficient privileges'} return list_for_object(request, node, rest)
def object_log(request, cluster_slug, host, rest=False): """ Display object log for this node """ node, cluster = get_node_and_cluster_or_404(cluster_slug, host) user = request.user if not (user.is_superuser or user.has_any_perms(cluster, ['admin', 'migrate'])): if not rest: raise Http403(NO_PRIVS) else: return {'error': NO_PRIVS} return list_for_object(request, node, rest)