# File lib/rhc/commands/authorization.rb, line 41 def add unless options.scopes say "When adding an authorization, you must specify which permissions clients will have." scope_help say "Run 'rhc authorization add --help' to see more options" return 0 end say "Adding authorization ... " auth = rest_client.add_authorization(:scope => options.scopes, :note => options.note, :expires_in => options.expires_in) success "done" paragraph{ display_authorization(auth) } 0 end
# File lib/rhc/commands/authorization.rb, line 65 def delete(tokens) raise ArgumentError, "You must specify one or more tokens to delete" if tokens.blank? say "Deleting authorization ... " tokens.each{ |token| rest_client.delete_authorization(token) } success "done" 0 end
# File lib/rhc/commands/authorization.rb, line 79 def delete_all say "Deleting all authorizations ... " rest_client.delete_authorizations success "done" 0 end
# File lib/rhc/commands/authorization.rb, line 14 def run rest_client.authorizations.each{ |auth| paragraph{ display_authorization(auth, options.token) } } or info "No authorizations" 0 end
# File lib/rhc/commands/authorization.rb, line 87 def scope_help descriptions = rest_client.authorization_scope_list paragraph{ say table(descriptions, :header => ['Scope', 'Description']) } paragraph{ say "You may pass multiple scopes to the --scopes option inside of double quotes (--scopes \"scope1 scope2\") or by separating them with commas (--scopes scope1,scope2)." } end