| 1 | #!/bin/false | ||||||||||
| 2 | # vim: softtabstop=4 tabstop=4 shiftwidth=4 ft=perl expandtab smarttab | ||||||||||
| 3 | # PODNAME: Net::Proxmox::VE::Access | ||||||||||
| 4 | # ABSTRACT: Functions for the 'access' portion of the API | ||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | package Net::Proxmox::VE::Access; | ||||||||||
| 10 | 2 | $Net::Proxmox::VE::Access::VERSION = '0.44'; | |||||||||
| 11 | 2 | ▶ | use parent 'Exporter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | use Net::Proxmox::VE::Exception; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 2 | ▶ | use JSON::MaybeXS qw(decode_json); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 2 | our @EXPORT = qw( | |||||||||
| 18 | access | ||||||||||
| 19 | access_domains | ||||||||||
| 20 | access_groups | ||||||||||
| 21 | access_roles | ||||||||||
| 22 | create_access_domains | ||||||||||
| 23 | create_access_groups | ||||||||||
| 24 | create_access_roles | ||||||||||
| 25 | create_access_users | ||||||||||
| 26 | delete_access_domains | ||||||||||
| 27 | delete_access_groups | ||||||||||
| 28 | delete_access_roles | ||||||||||
| 29 | delete_access_users | ||||||||||
| 30 | get_access_domains | ||||||||||
| 31 | get_access_groups | ||||||||||
| 32 | get_access_roles | ||||||||||
| 33 | get_access_users | ||||||||||
| 34 | update_access_domains | ||||||||||
| 35 | update_access_groups | ||||||||||
| 36 | update_access_roles | ||||||||||
| 37 | update_access_users | ||||||||||
| 38 | sync_access_domains | ||||||||||
| 39 | get_access_acl | ||||||||||
| 40 | update_access_acl | ||||||||||
| 41 | update_access_password | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 2 | my $BASEPATH = '/access'; | |||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub access { | ||||||||
|
Subroutine
access: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | return $self->get($BASEPATH); | |||||||||
| 52 | |||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub access_domains { | ||||||||
|
Subroutine
access_domains: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | |||||||||||
| 60 | 0 | return $self->get( $BASEPATH, 'domains' ); | |||||||||
| 61 | |||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | sub create_access_domains { | ||||||||
|
Subroutine
create_access_domains: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | 0 | my @p = @_; | |||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | 'No arguments for create_access_domains()') | ||||||||||
| 72 | unless @p; | ||||||||||
| 73 | 0 | my %args; | |||||||||
| 74 | |||||||||||
| 75 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 77 | 'Single argument not a hash for create_access_domains()') | ||||||||||
| 78 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 79 | 0 | %args = %{ $p[0] }; | |||||||||
| 80 | } | ||||||||||
| 81 | else { | ||||||||||
| 82 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 83 | 'Odd number of arguments for create_access_domains()') | ||||||||||
| 84 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 85 | 0 | %args = @p; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 0 | return $self->post( $BASEPATH, 'domains', \%args ); | |||||||||
| 89 | |||||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | 0 | ▶ | sub get_access_domains { | ||||||||
|
Subroutine
get_access_domains: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 94 | |||||||||||
| 95 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | |||||||||||
| 97 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 98 | or | ||||||||||
| 99 | Net::Proxmox::VE::Exception->throw('No realm for get_access_domains()'); | ||||||||||
| 100 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 101 | 'realm must be a scalar for get_access_domains()') | ||||||||||
| 102 | if ref $realm; | ||||||||||
| 103 | |||||||||||
| 104 | 0 | return $self->get( $BASEPATH, 'domains', $realm ); | |||||||||
| 105 | |||||||||||
| 106 | } | ||||||||||
| 107 | |||||||||||
| 108 | |||||||||||
| 109 | 0 | ▶ | sub update_access_domains { | ||||||||
|
Subroutine
update_access_domains: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||
| 110 | |||||||||||
| 111 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 112 | |||||||||||
| 113 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 114 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 115 | 'No realm provided for update_access_domains()'); | ||||||||||
| 116 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 117 | 'realm must be a scalar for update_access_domains()') | ||||||||||
| 118 | if ref $realm; | ||||||||||
| 119 | 0 | my @p = @_; | |||||||||
| 120 | |||||||||||
| 121 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 122 | 'No arguments for update_access_domains()') | ||||||||||
| 123 | unless @p; | ||||||||||
| 124 | 0 | my %args; | |||||||||
| 125 | |||||||||||
| 126 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 127 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 128 | 'Single argument not a hash for update_access_domains()') | ||||||||||
| 129 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 130 | 0 | %args = %{ $p[0] }; | |||||||||
| 131 | } | ||||||||||
| 132 | else { | ||||||||||
| 133 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 134 | 'Odd number of arguments for update_access_domains()') | ||||||||||
| 135 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 136 | 0 | %args = @p; | |||||||||
| 137 | } | ||||||||||
| 138 | |||||||||||
| 139 | 0 | return $self->put( $BASEPATH, 'domains', $realm, \%args ); | |||||||||
| 140 | |||||||||||
| 141 | } | ||||||||||
| 142 | |||||||||||
| 143 | |||||||||||
| 144 | 0 | ▶ | sub delete_access_domains { | ||||||||
|
Subroutine
delete_access_domains: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 145 | |||||||||||
| 146 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 147 | |||||||||||
| 148 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 149 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 150 | 'No realm provided for delete_access_domains()'); | ||||||||||
| 151 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 152 | 'realm must be a scalar for delete_access_domains()') | ||||||||||
| 153 | if ref $realm; | ||||||||||
| 154 | |||||||||||
| 155 | 0 | return $self->delete( $BASEPATH, 'domains', $realm ); | |||||||||
| 156 | |||||||||||
| 157 | } | ||||||||||
| 158 | |||||||||||
| 159 | ### | ||||||||||
| 160 | # | ||||||||||
| 161 | |||||||||||
| 162 | |||||||||||
| 163 | 0 | ▶ | sub sync_access_domains { | ||||||||
|
Subroutine
sync_access_domains: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||
| 164 | |||||||||||
| 165 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 166 | |||||||||||
| 167 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 168 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 169 | 'No realm provided for sync_access_groups()'); | ||||||||||
| 170 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 171 | 'realm must be a scalar for sync_access_groups()') | ||||||||||
| 172 | if ref $realm; | ||||||||||
| 173 | |||||||||||
| 174 | 0 | my @p = @_; | |||||||||
| 175 | |||||||||||
| 176 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for sync_access_domains()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 177 | unless @p; | ||||||||||
| 178 | 0 | my %args; | |||||||||
| 179 | |||||||||||
| 180 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 181 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 182 | 'Single argument not a hash for sync_access_domains()') | ||||||||||
| 183 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 184 | 0 | %args = %{ $p[0] }; | |||||||||
| 185 | } | ||||||||||
| 186 | else { | ||||||||||
| 187 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 188 | 'Odd number of arguments for sync_access_domains()') | ||||||||||
| 189 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 190 | 0 | %args = @p; | |||||||||
| 191 | } | ||||||||||
| 192 | |||||||||||
| 193 | 0 | return $self->post( $BASEPATH, 'domains', \%args ); | |||||||||
| 194 | |||||||||||
| 195 | } | ||||||||||
| 196 | |||||||||||
| 197 | |||||||||||
| 198 | 0 | ▶ | sub access_groups { | ||||||||
|
Subroutine
access_groups: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 199 | |||||||||||
| 200 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 201 | |||||||||||
| 202 | 0 | return $self->get( $BASEPATH, 'groups' ); | |||||||||
| 203 | |||||||||||
| 204 | } | ||||||||||
| 205 | |||||||||||
| 206 | |||||||||||
| 207 | 0 | ▶ | sub create_access_groups { | ||||||||
|
Subroutine
create_access_groups: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 208 | |||||||||||
| 209 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 210 | 0 | my @p = @_; | |||||||||
| 211 | |||||||||||
| 212 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 213 | 'No arguments for create_access_groups()') | ||||||||||
| 214 | unless @p; | ||||||||||
| 215 | 0 | my %args; | |||||||||
| 216 | |||||||||||
| 217 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 218 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 219 | 'Single argument not a hash for create_access_groups()') | ||||||||||
| 220 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 221 | 0 | %args = %{ $p[0] }; | |||||||||
| 222 | } | ||||||||||
| 223 | else { | ||||||||||
| 224 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 225 | 'Odd number of arguments for create_access_groups()') | ||||||||||
| 226 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 227 | 0 | %args = @p; | |||||||||
| 228 | } | ||||||||||
| 229 | |||||||||||
| 230 | 0 | return $self->post( $BASEPATH, 'groups', \%args ); | |||||||||
| 231 | |||||||||||
| 232 | } | ||||||||||
| 233 | |||||||||||
| 234 | |||||||||||
| 235 | 0 | ▶ | sub get_access_groups { | ||||||||
|
Subroutine
get_access_groups: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 236 | |||||||||||
| 237 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 238 | |||||||||||
| 239 | 0 | ▶ | my $groupid = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 240 | or | ||||||||||
| 241 | Net::Proxmox::VE::Exception->throw('No groupid for get_access_groups()'); | ||||||||||
| 242 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 243 | 'groupid must be a scalar for get_access_groups()') | ||||||||||
| 244 | if ref $groupid; | ||||||||||
| 245 | |||||||||||
| 246 | 0 | return $self->get( $BASEPATH, 'groups', $groupid ); | |||||||||
| 247 | |||||||||||
| 248 | } | ||||||||||
| 249 | |||||||||||
| 250 | |||||||||||
| 251 | 0 | ▶ | sub update_access_groups { | ||||||||
|
Subroutine
update_access_groups: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||
| 252 | |||||||||||
| 253 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 254 | |||||||||||
| 255 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 256 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 257 | 'No realm provided for update_access_groups()'); | ||||||||||
| 258 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 259 | 'realm must be a scalar for update_access_groups()') | ||||||||||
| 260 | if ref $realm; | ||||||||||
| 261 | |||||||||||
| 262 | 0 | my @p = @_; | |||||||||
| 263 | |||||||||||
| 264 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 265 | 'No arguments for update_access_groups()') | ||||||||||
| 266 | unless @p; | ||||||||||
| 267 | 0 | my %args; | |||||||||
| 268 | |||||||||||
| 269 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 270 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 271 | 'Single argument not a hash for update_access_groups()') | ||||||||||
| 272 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 273 | 0 | %args = %{ $p[0] }; | |||||||||
| 274 | } | ||||||||||
| 275 | else { | ||||||||||
| 276 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 277 | 'Odd number of arguments for update_access_groups()') | ||||||||||
| 278 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 279 | 0 | %args = @p; | |||||||||
| 280 | } | ||||||||||
| 281 | |||||||||||
| 282 | 0 | return $self->put( $BASEPATH, 'groups', $realm, \%args ); | |||||||||
| 283 | |||||||||||
| 284 | } | ||||||||||
| 285 | |||||||||||
| 286 | |||||||||||
| 287 | 0 | ▶ | sub delete_access_groups { | ||||||||
|
Subroutine
delete_access_groups: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 288 | |||||||||||
| 289 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 290 | 0 | ▶ | my $groupid = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 291 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 292 | 'No argument given for delete_access_groups()'); | ||||||||||
| 293 | |||||||||||
| 294 | 0 | return $self->delete( $BASEPATH, 'groups', $groupid ); | |||||||||
| 295 | |||||||||||
| 296 | } | ||||||||||
| 297 | |||||||||||
| 298 | |||||||||||
| 299 | 0 | ▶ | sub access_roles { | ||||||||
|
Subroutine
access_roles: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 300 | |||||||||||
| 301 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 302 | |||||||||||
| 303 | 0 | return $self->get( $BASEPATH, 'roles' ); | |||||||||
| 304 | |||||||||||
| 305 | } | ||||||||||
| 306 | |||||||||||
| 307 | |||||||||||
| 308 | 0 | ▶ | sub create_access_roles { | ||||||||
|
Subroutine
create_access_roles: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 309 | |||||||||||
| 310 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 311 | 0 | my @p = @_; | |||||||||
| 312 | |||||||||||
| 313 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for create_access_roles()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 314 | unless @p; | ||||||||||
| 315 | 0 | my %args; | |||||||||
| 316 | |||||||||||
| 317 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 318 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 319 | 'Single argument not a hash for create_access_roles()') | ||||||||||
| 320 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 321 | 0 | %args = %{ $p[0] }; | |||||||||
| 322 | } | ||||||||||
| 323 | else { | ||||||||||
| 324 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 325 | 'Odd number of arguments for create_access_roles()') | ||||||||||
| 326 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 327 | 0 | %args = @p; | |||||||||
| 328 | } | ||||||||||
| 329 | |||||||||||
| 330 | 0 | return $self->post( $BASEPATH, 'roles', \%args ); | |||||||||
| 331 | |||||||||||
| 332 | } | ||||||||||
| 333 | |||||||||||
| 334 | |||||||||||
| 335 | 0 | ▶ | sub get_access_roles { | ||||||||
|
Subroutine
get_access_roles: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 336 | |||||||||||
| 337 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 338 | |||||||||||
| 339 | 0 | ▶ | my $roleid = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 340 | or Net::Proxmox::VE::Exception->throw('No roleid for get_access_roles()'); | ||||||||||
| 341 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 342 | 'roleid must be a scalar for get_access_roles()') | ||||||||||
| 343 | if ref $roleid; | ||||||||||
| 344 | |||||||||||
| 345 | 0 | return $self->get( $BASEPATH, 'roles', $roleid ); | |||||||||
| 346 | |||||||||||
| 347 | } | ||||||||||
| 348 | |||||||||||
| 349 | |||||||||||
| 350 | 0 | ▶ | sub update_access_roles { | ||||||||
|
Subroutine
update_access_roles: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||
| 351 | |||||||||||
| 352 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 353 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 354 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 355 | 'No realm provided for update_access_roles()'); | ||||||||||
| 356 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 357 | 'realm must be a scalar for update_access_roles()') | ||||||||||
| 358 | if ref $realm; | ||||||||||
| 359 | 0 | my @p = @_; | |||||||||
| 360 | |||||||||||
| 361 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for update_access_roles()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 362 | unless @p; | ||||||||||
| 363 | 0 | my %args; | |||||||||
| 364 | |||||||||||
| 365 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 366 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 367 | 'Single argument not a hash for update_access_roles()') | ||||||||||
| 368 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 369 | 0 | %args = %{ $p[0] }; | |||||||||
| 370 | } | ||||||||||
| 371 | else { | ||||||||||
| 372 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 373 | 'Odd number of arguments for update_access_roles()') | ||||||||||
| 374 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 375 | 0 | %args = @p; | |||||||||
| 376 | } | ||||||||||
| 377 | |||||||||||
| 378 | 0 | return $self->put( $BASEPATH, 'roles', $realm, \%args ); | |||||||||
| 379 | |||||||||||
| 380 | } | ||||||||||
| 381 | |||||||||||
| 382 | |||||||||||
| 383 | 0 | ▶ | sub delete_access_roles { | ||||||||
|
Subroutine
delete_access_roles: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 384 | |||||||||||
| 385 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 386 | 0 | ▶ | my $roleid = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 387 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 388 | 'No argument given for delete_access_roles()'); | ||||||||||
| 389 | |||||||||||
| 390 | 0 | return $self->delete( $BASEPATH, 'roles', $roleid ); | |||||||||
| 391 | |||||||||||
| 392 | } | ||||||||||
| 393 | |||||||||||
| 394 | |||||||||||
| 395 | 0 | ▶ | sub access_users { | ||||||||
|
Subroutine
access_users: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 396 | |||||||||||
| 397 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 398 | |||||||||||
| 399 | 0 | return $self->get( $BASEPATH, 'users' ); | |||||||||
| 400 | |||||||||||
| 401 | } | ||||||||||
| 402 | |||||||||||
| 403 | |||||||||||
| 404 | 0 | ▶ | sub create_access_users { | ||||||||
|
Subroutine
create_access_users: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 405 | |||||||||||
| 406 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 407 | 0 | my @p = @_; | |||||||||
| 408 | |||||||||||
| 409 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for create_access_users()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 410 | unless @p; | ||||||||||
| 411 | 0 | my %args; | |||||||||
| 412 | |||||||||||
| 413 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 414 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 415 | 'Single argument not a hash for create_access_users()') | ||||||||||
| 416 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 417 | 0 | %args = %{ $p[0] }; | |||||||||
| 418 | } | ||||||||||
| 419 | else { | ||||||||||
| 420 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 421 | 'Odd number of arguments for create_access_users()') | ||||||||||
| 422 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 423 | 0 | %args = @p; | |||||||||
| 424 | } | ||||||||||
| 425 | |||||||||||
| 426 | 0 | return $self->post( $BASEPATH, 'users', \%args ); | |||||||||
| 427 | |||||||||||
| 428 | } | ||||||||||
| 429 | |||||||||||
| 430 | |||||||||||
| 431 | 0 | ▶ | sub get_access_users { | ||||||||
|
Subroutine
get_access_users: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 432 | |||||||||||
| 433 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 434 | |||||||||||
| 435 | 0 | ▶ | my $userid = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 436 | or Net::Proxmox::VE::Exception->throw('No userid for get_access_users()'); | ||||||||||
| 437 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 438 | 'userid must be a scalar for get_access_users()') | ||||||||||
| 439 | if ref $userid; | ||||||||||
| 440 | |||||||||||
| 441 | 0 | return $self->get( $BASEPATH, 'users', $userid ); | |||||||||
| 442 | |||||||||||
| 443 | } | ||||||||||
| 444 | |||||||||||
| 445 | |||||||||||
| 446 | 0 | ▶ | sub update_access_users { | ||||||||
|
Subroutine
update_access_users: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||
| 447 | |||||||||||
| 448 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 449 | 0 | ▶ | my $realm = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 450 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 451 | 'No realm provided for update_access_users()'); | ||||||||||
| 452 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 453 | 'realm must be a scalar for update_access_users()') | ||||||||||
| 454 | if ref $realm; | ||||||||||
| 455 | 0 | my @p = @_; | |||||||||
| 456 | |||||||||||
| 457 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for update_access_users()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 458 | unless @p; | ||||||||||
| 459 | 0 | my %args; | |||||||||
| 460 | |||||||||||
| 461 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 462 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 463 | 'Single argument not a hash for update_access_users()') | ||||||||||
| 464 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 465 | 0 | %args = %{ $p[0] }; | |||||||||
| 466 | } | ||||||||||
| 467 | else { | ||||||||||
| 468 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 469 | 'Odd number of arguments for update_access_users()') | ||||||||||
| 470 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 471 | 0 | %args = @p; | |||||||||
| 472 | } | ||||||||||
| 473 | |||||||||||
| 474 | 0 | return $self->put( $BASEPATH, 'users', $realm, \%args ); | |||||||||
| 475 | |||||||||||
| 476 | } | ||||||||||
| 477 | |||||||||||
| 478 | |||||||||||
| 479 | 0 | ▶ | sub delete_access_users { | ||||||||
|
Subroutine
delete_access_users: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 480 | |||||||||||
| 481 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 482 | 0 | ▶ | my $userid = shift | ||||||||
|
Branch: 1 branch
| |||||||||||
| 483 | or Net::Proxmox::VE::Exception->throw( | ||||||||||
| 484 | 'No argument given for delete_access_users()'); | ||||||||||
| 485 | |||||||||||
| 486 | 0 | return $self->delete( $BASEPATH, 'users', $userid ); | |||||||||
| 487 | |||||||||||
| 488 | } | ||||||||||
| 489 | |||||||||||
| 490 | |||||||||||
| 491 | 0 | ▶ | sub get_access_acl { | ||||||||
|
Subroutine
get_access_acl: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 492 | |||||||||||
| 493 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 494 | |||||||||||
| 495 | 0 | return $self->get( $BASEPATH, 'acl' ); | |||||||||
| 496 | |||||||||||
| 497 | } | ||||||||||
| 498 | |||||||||||
| 499 | |||||||||||
| 500 | 0 | ▶ | sub update_access_acl { | ||||||||
|
Subroutine
update_access_acl: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 501 | |||||||||||
| 502 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 503 | 0 | my @p = @_; | |||||||||
| 504 | |||||||||||
| 505 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for update_acl()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 506 | unless @p; | ||||||||||
| 507 | 0 | my %args; | |||||||||
| 508 | |||||||||||
| 509 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 510 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 511 | 'Single argument not a hash for update_acl()') | ||||||||||
| 512 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 513 | 0 | %args = %{ $p[0] }; | |||||||||
| 514 | } | ||||||||||
| 515 | else { | ||||||||||
| 516 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 517 | 'Odd number of arguments for update_acl()') | ||||||||||
| 518 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 519 | 0 | %args = @p; | |||||||||
| 520 | } | ||||||||||
| 521 | |||||||||||
| 522 | 0 | return $self->put( $BASEPATH, 'acl', \%args ); | |||||||||
| 523 | |||||||||||
| 524 | } | ||||||||||
| 525 | |||||||||||
| 526 | |||||||||||
| 527 | 0 | ▶ | sub update_access_password { | ||||||||
|
Subroutine
update_access_password: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 528 | |||||||||||
| 529 | 0 | ▶ | my $self = shift or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 530 | 0 | my @p = @_; | |||||||||
| 531 | |||||||||||
| 532 | 0 | ▶ | Net::Proxmox::VE::Exception->throw('No arguments for update_password()') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 533 | unless @p; | ||||||||||
| 534 | 0 | my %args; | |||||||||
| 535 | |||||||||||
| 536 | 0 | ▶ | if ( @p == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 537 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 538 | 'Single argument not a hash for update_password()') | ||||||||||
| 539 | unless ref $p[0] eq 'HASH'; | ||||||||||
| 540 | 0 | %args = %{ $p[0] }; | |||||||||
| 541 | } | ||||||||||
| 542 | else { | ||||||||||
| 543 | 0 | ▶ | Net::Proxmox::VE::Exception->throw( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 544 | 'Odd number of arguments for update_password()') | ||||||||||
| 545 | if ( scalar @p % 2 != 0 ); | ||||||||||
| 546 | 0 | %args = @p; | |||||||||
| 547 | } | ||||||||||
| 548 | |||||||||||
| 549 | 0 | return $self->put( $BASEPATH, 'password', \%args ); | |||||||||
| 550 | |||||||||||
| 551 | } | ||||||||||
| 552 | |||||||||||
| 553 | |||||||||||
| 554 | 2 | 1; | |||||||||
| 555 | |||||||||||
| 556 | __END__ | ||||||||||