all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Oguz Bektas <o.bektas@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] fix permissions for APT
Date: Mon, 30 Aug 2021 12:02:04 +0200	[thread overview]
Message-ID: <20210830100204.437455-1-o.bektas@proxmox.com> (raw)

it wrongly uses the permission model from PVE, fix those to allow
PMG users with administrator role to add/delete repositories, and
auditor role to view the repositories.

reported in forum [0]

[0]:
https://forum.proxmox.com/threads/no-apt-repo-information-for-non-root-on-the-web-gui.95217/

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
 src/PMG/API2/APT.pm | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/PMG/API2/APT.pm b/src/PMG/API2/APT.pm
index 5e132c4..18bb992 100644
--- a/src/PMG/API2/APT.pm
+++ b/src/PMG/API2/APT.pm
@@ -477,9 +477,7 @@ __PACKAGE__->register_method({
     method => 'GET',
     proxyto => 'node',
     description => "Get APT repository information.",
-    permissions => {
-	check => ['perm', '/nodes/{node}', [ 'Sys.Audit' ]],
-    },
+    permissions => { check => [ 'admin', 'audit' ] },
     parameters => {
 	additionalProperties => 0,
 	properties => {
@@ -678,9 +676,7 @@ __PACKAGE__->register_method({
     path => 'repositories',
     method => 'PUT',
     description => "Add a standard repository to the configuration",
-    permissions => {
-	check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
-    },
+    permissions => { check => [ 'admin' ] },
     protected => 1,
     proxyto => 'node',
     parameters => {
@@ -713,9 +709,7 @@ __PACKAGE__->register_method({
     path => 'repositories',
     method => 'POST',
     description => "Change the properties of a repository. Currently only allows enabling/disabling.",
-    permissions => {
-	check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
-    },
+    permissions => { check => [ 'admin' ] },
     protected => 1,
     proxyto => 'node',
     parameters => {
-- 
2.30.2





             reply	other threads:[~2021-08-30 10:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 10:02 Oguz Bektas [this message]
2021-08-30 13:38 ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210830100204.437455-1-o.bektas@proxmox.com \
    --to=o.bektas@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal