]> git.proxmox.com Git - pve-access-control.git/blobdiff - PVE/RPCEnvironment.pm
allow users to change his own password
[pve-access-control.git] / PVE / RPCEnvironment.pm
index d14104a7cacfb4624d77e6555871b7276a94147e..af2eee80e3ce80222595c42a42b238cd528bdbaf 100644 (file)
@@ -14,6 +14,7 @@ use PVE::INotify;
 use PVE::Cluster;
 use PVE::ProcFSTools;
 use PVE::AccessControl;
+use Cwd 'abs_path';
 use CGI;
 
 # we use this singleton class to pass RPC related environment values
@@ -288,7 +289,8 @@ sub check_volume_access {
     # test if we have read access to volid
 
     my $path;
-    if (my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1)) {
+    my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
+    if ($sid) {
        my ($ownervm, $vtype);
        ($path, $ownervm, $vtype) = PVE::Storage::path($storecfg, $volid);
        if ($vtype eq 'iso' || $vtype eq 'vztmpl') {
@@ -421,12 +423,12 @@ sub exec_api2_perm_check {
        }
        return 1;
     } elsif ($test eq 'userid-param') {
-       my ($userid, undef, $realm) = verify_username($param->{userid});
-       return if !$self->check_user_exist($userid, $noerr);
+       my ($userid, undef, $realm) = PVE::AccessControl::verify_username($param->{userid});
        my ($t, $subtest) = @$check;
        die "missing parameters" if !$subtest;
        if ($subtest eq 'self') {
-           return 1 if $username eq 'userid';
+           return 0 if !$self->check_user_exist($userid, $noerr);
+           return 1 if $username eq $userid;
            return 0 if $noerr;
            raise_perm_exc();
        } elsif ($subtest eq 'Realm.AllocateUser') {