lib/magellan/cli/resources/authority.rb in magellan-cli-0.7.0 vs lib/magellan/cli/resources/authority.rb in magellan-cli-0.7.1
- old
+ new
@@ -7,11 +7,11 @@
class Authority < Base
self.resource_key = "magellan~auth~authority"
self.resource_dependency = { "team" => Team.parameter_name }
self.hidden_fields = %w[auth_type created_at updated_at].map(&:freeze).freeze
- self.field_associations = {"team_id" => {name: "team", class: "Organization"},
+ self.field_associations = {"team_id" => {name: "team", class: "Team"},
"auth_id" => {name: "project", class: "Project"} }
desc "update ATTRIBUTES", I18n.t(:update, scope: [:resources, :common, :cmd], resource_name: resource_name)
def update(attrs)
s = load_selection!(self.class)
@@ -46,10 +46,13 @@
"project_role" => project_role,
"stage_role" => stage_role,
"stage_type" => stage_type_map[stage_type],
}
}
- post_json("/admin/#{resource_key}/new.json", params)
+ ret = post_json("/admin/#{resource_key}/new.json", params)
+ if ret and ret["id"]
+ select ret["id"]
+ end
end
desc "select ID", I18n.t(:select, scope: [:resources, :authority, :cmd], resource_name: resource_name)
def select(id)
q = build_query("id" => id)