OrganizationUsers add pm_check_user

This commit is contained in:
呱呱呱 2023-10-12 11:25:23 +08:00
parent 19d36af37f
commit d60ba95444
3 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,7 @@
class Organizations::OrganizationUsersController < Organizations::BaseController
before_action :load_organization
before_action :load_operate_user, :load_organization_user, :check_user_can_edit_org, only: [:destroy]
before_action :load_operate_user, :load_organization_user, only: [:destroy, :pm_check_user]
before_action :check_user_can_edit_org, only: [:destroy]
def index
@organization_users = @organization.organization_users.includes(:user)
@ -16,6 +17,10 @@ class Organizations::OrganizationUsersController < Organizations::BaseController
@organization_users = kaminari_paginate(@organization_users)
end
def pm_check_user
render_ok
end
def destroy
tip_exception("您不能从所有者团队中删除最后一个用户") if @organization.is_owner_team_last_one?(@operate_user.id)
ActiveRecord::Base.transaction do

View File

@ -1,8 +1,8 @@
class Organizations::TeamUsersController < Organizations::BaseController
before_action :load_organization, :load_team
before_action :load_operate_user, only: [:create, :destroy, :check_user]
before_action :load_operate_user, only: [:create, :destroy, :pm_check_user]
before_action :check_user_profile_completed, only: [:create]
before_action :load_team_user, only: [:destroy, :check_user]
before_action :load_team_user, only: [:destroy, :pm_check_user]
before_action :check_user_can_edit_org, only: [:create, :destroy]
def index

View File

@ -146,6 +146,7 @@ Rails.application.routes.draw do
resources :organization_users, only: [:index, :destroy] do
collection do
delete :quit
get :pm_check_user
end
end
resources :clas