Exemple #1
0
def users(request, cluster_slug):
    """
    Display all of the Users of a 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")
    
    url = reverse('cluster-permissions', args=[cluster.slug])
    return view_users(request, cluster, url, template='cluster/users.html')
Exemple #2
0
def users(request, cluster_slug):
    """
    Display all of the Users of a 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 Http403(NO_PRIVS)

    url = reverse('cluster-permissions', args=[cluster.slug])
    return view_users(request, cluster, url, template='ganeti/cluster/users.html')
Exemple #3
0
def users(request, cluster_slug, instance):
    """
    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")

    url = reverse('vm-permissions', args=[cluster.slug, vm.hostname])
    return view_users(request, vm, url)
Exemple #4
0
def users(request, cluster_slug):
    """
    Display all of the Users of a 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)

    url = reverse('cluster-permissions', args=[cluster.slug])
    return view_users(request,
                      cluster,
                      url,
                      template='ganeti/cluster/users.html')
def users(request, cluster_slug, instance, rest=False):
    """
    Display all of the Users of a VirtualMachine
    """
    vm, cluster = get_vm_and_cluster_or_404(cluster_slug, instance)

    user = request.user
    if not (user.is_superuser or user.has_perm('admin', vm) or
            user.has_perm('admin', cluster)):
        if rest:
            return {'msg': NO_PRIVS, 'code': 403}
        else:
            raise Http403(NO_PRIVS)

    url = reverse('vm-permissions', args=[cluster.slug, vm.hostname])
    return view_users(request, vm, url, rest=rest)
def users(request, cluster_slug, instance, rest=False):
    """
    Display all of the Users of a VirtualMachine
    """
    vm, cluster = get_vm_and_cluster_or_404(cluster_slug, instance)

    user = request.user
    if not (user.is_superuser or user.has_perm('admin', vm) or
        user.has_perm('admin', cluster)):
        if rest:
            return {'msg': NO_PRIVS, 'code': 403}
        else:
            raise Http403(NO_PRIVS)

    url = reverse('vm-permissions', args=[cluster.slug, vm.hostname])
    return view_users(request, vm, url, rest=rest)
Exemple #7
0
def users(request, cluster_slug, instance, rest=False):
    """
    Display all of the Users of a VirtualMachine
    """
    vm, cluster = get_vm_and_cluster_or_404(cluster_slug, instance)

    user = request.user
    if not (user.is_superuser or user.has_perm('admin', vm) or
        user.has_perm('admin', cluster)):
        if not rest:
            return render_403(request, _("You do not have sufficient privileges"))
        else:
            return {'msg':'You do not have sufficient privileges', 'code':403}

    url = reverse('vm-permissions', args=[cluster.slug, vm.hostname])
    return view_users(request, vm, url, rest = True)