accept_attribute_as_json :scopes, Array
before_filter :current_api_client_is_trusted
before_filter :admin_required, :only => :create_system_auth
+ skip_before_filter :render_404_if_no_object, :only => :create_system_auth
def self._create_system_auth_requires_parameters
{
}
end
def create_system_auth
- api_client_auth = ApiClientAuthorization.
+ @object = ApiClientAuthorization.
new(user_id: system_user.id,
api_client_id: params[:api_client_id] || current_api_client.andand.id,
created_by_ip_address: remote_ip,
scopes: Oj.load(params[:scopes] || '["all"]'))
- api_client_auth.save!
- render :json => api_client_auth.as_api_response(:superuser)
+ @object.save!
+ show
end
def create
resource_attrs[:user_id] =
User.where(uuid: resource_attrs.delete(:owner_uuid)).first.andand.id
end
+ resource_attrs[:api_client_id] = Thread.current[:api_client].id
super
end