From 24e913fb2c5bef67e195c144738994caaa2973ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 21 Jan 2013 17:27:07 +0100 Subject: [PATCH] Feature #1681: Add command oneuser umask --- src/cli/oneuser | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/cli/oneuser b/src/cli/oneuser index 357cfa4887..28157f0f52 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -270,6 +270,39 @@ cmd=CommandParser::CmdParser.new(ARGV) do exit 0 end + umask_desc = <<-EOT.unindent + Changes the umask used to create the default permissions. In a similar + way to the Unix umask command, the expected value is a three-digit + base-8 number. Each digit is a mask that disables permissions for the + owner, group and other, respectively. + + If mask is not given, or if it is an empty string, the umask will + be unset + EOT + + command :umask, umask_desc, [:range, :userid_list], [:mask, nil] do + helper.perform_actions(args[0],options, + "umask changed") do |user| + + rc = user.info + + if OpenNebula.is_error?(rc) + puts rc.message + exit -1 + end + + user.delete_element('/USER/TEMPLATE/UMASK') + + tmp_str = user.template_str + + if !args[1].nil? && args[1] != "" + tmp_str << "\nUMASK = #{args[1]}" + end + + user.update(tmp_str) + end + end + login_desc = <<-EOT.unindent Creates the Login token for authentication Examples: