mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
feature #788: Add delete quota functionality
This commit is contained in:
parent
d16a20c757
commit
f308f38fc5
@ -130,6 +130,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
exit_with_code 0
|
||||
end
|
||||
|
||||
########################################################################
|
||||
delete_desc = "Delete the defined quotas for the given user"
|
||||
|
||||
command :delete, delete_desc, :userid do
|
||||
quota.delete_quota(args[0])
|
||||
exit_with_code 0
|
||||
end
|
||||
|
||||
########################################################################
|
||||
show_desc = "Show the user's quota and usage. (usage/quota)"
|
||||
|
||||
|
@ -127,13 +127,22 @@ class Quota
|
||||
if limit
|
||||
limit
|
||||
else
|
||||
@conf[:defaults]
|
||||
@conf[:defaults].merge!(:uid => uid)
|
||||
end
|
||||
else
|
||||
@db[table].all
|
||||
end
|
||||
end
|
||||
|
||||
# Delete user limits
|
||||
def delete(table, uid)
|
||||
quotas=@db[table].filter(:uid => uid)
|
||||
|
||||
if quotas.first
|
||||
quotas.delete
|
||||
end
|
||||
end
|
||||
|
||||
###########################################################################
|
||||
# Quota Client
|
||||
###########################################################################
|
||||
@ -145,6 +154,10 @@ class Quota
|
||||
get(QUOTA_TABLE, uid)
|
||||
end
|
||||
|
||||
def delete_quota(uid)
|
||||
delete(QUOTA_TABLE, uid)
|
||||
end
|
||||
|
||||
###########################################################################
|
||||
# Authorization
|
||||
###########################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user