Skip to content

Commit

Permalink
api: fix admin check in IpAddress.AssignWithHostAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
aither64 committed May 29, 2021
1 parent 5365ba1 commit 9899edd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/lib/vpsadmin/api/resources/ip_address.rb
Expand Up @@ -420,7 +420,10 @@ def exec
maintenance_check!(netif.vps)
object_state_check!(netif.vps, netif.vps.user)

@chain, _ = netif.add_route(ip, host_addrs: [host_addr])
@chain, _ = netif.add_route(
ip, host_addrs: [host_addr],
is_user: current_user.role != :admin,
)
ip

rescue VpsAdmin::API::Exceptions::IpAddressInUse
Expand Down

0 comments on commit 9899edd

Please sign in to comment.