|
- class Admins::OrganizationsController < Admins::BaseController
- before_action :finder_org, except: [:index]
-
- def index
- params[:sort_by] = params[:sort_by].presence || 'created_on'
- params[:sort_direction] = params[:sort_direction].presence || 'desc'
-
- orgs = Admins::OrganizationQuery.call(params)
- @orgs = paginate orgs
- end
-
-
- def open_cla
- @org.open_cla!
- render_ok
- end
-
- def close_cla
- if @org.cla.nil?
- @org.close_cla!
- render_ok
- else
- render_error(' 该组织已创建CLA 不允许关闭')
- end
-
- end
-
- def show
- end
-
- def destroy
- @org.destroy!
- Admins::DeleteOrganizationService.call(@org.login)
- UserAction.create(action_id: @org.id, action_type: "DestroyOrganization", user_id: current_user.id, :ip => request.remote_ip, data_bank: @org.attributes.to_json)
- render_delete_success
- end
-
- private
-
- def finder_org
- @org = Organization.find(params[:id])
- end
-
- end
|