diff --git a/src/authm_mad/remotes/quota/onequota b/src/authm_mad/remotes/quota/onequota index dd0705cd60..a6fd24e669 100755 --- a/src/authm_mad/remotes/quota/onequota +++ b/src/authm_mad/remotes/quota/onequota @@ -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)" diff --git a/src/authm_mad/remotes/quota/quota.rb b/src/authm_mad/remotes/quota/quota.rb index 93014848c1..9e259e271d 100644 --- a/src/authm_mad/remotes/quota/quota.rb +++ b/src/authm_mad/remotes/quota/quota.rb @@ -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 ###########################################################################