Sha256: 3a37308052b3bb019803425f73a40befa19c8aa52ba3714a4163bb987c8b110c
Contents?: true
Size: 1.17 KB
Versions: 7
Compression:
Stored size: 1.17 KB
Contents
require 'conjur/authn' require 'conjur/command' class Conjur::Command::Groups < Conjur::Command self.prefix = :group desc "Create a new group" arg_name "id" command :create do |c| acting_as_option(c) c.action do |global_options,options,args| id = require_arg(args, 'id') group = api.create_group(id, options) puts "Created #{group}" end end desc "Add a new group member" arg_name "group member" command :"members:add" do |c| c.desc "Grant with admin option" c.switch [:a, :admin] c.action do |global_options,options,args| group = require_arg(args, 'group') member = require_arg(args, 'member') group = api.group(group) api.role(group.roleid).grant_to member, !!options[:admin] puts "Membership granted" end end desc "Remove a group member" arg_name "group member" command :"members:remove" do |c| c.action do |global_options,options,args| group = require_arg(args, 'group') member = require_arg(args, 'member') group = api.group(group) api.role(group.roleid).revoke_from member puts "Membership revoked" end end end
Version data entries
7 entries across 7 versions & 1 rubygems