mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-17 18:25:56 +08:00
[ADD]组织项目相关
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class Organizations::TeamsController < Organizations::BaseController
|
||||
before_action :load_organization
|
||||
before_action :load_team, only: [:show, :update, :destroy]
|
||||
before_action :check_user_can_edit_org, only: [:create, :update, :destroy]
|
||||
|
||||
def index
|
||||
if @organization.is_owner?(current_user)
|
||||
@@ -16,7 +17,6 @@ class Organizations::TeamsController < Organizations::BaseController
|
||||
end
|
||||
|
||||
def create
|
||||
tip_exception("您没有权限进行该操作") unless @organization.is_owner?(current_user)
|
||||
@team = Organizations::Teams::CreateService.call(current_user, @organization, team_params)
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
@@ -24,7 +24,6 @@ class Organizations::TeamsController < Organizations::BaseController
|
||||
end
|
||||
|
||||
def update
|
||||
tip_exception("您没有权限进行该操作") unless @organization.is_owner?(current_user)
|
||||
@team = Organizations::Teams::UpdateService.call(current_user, @team, team_params)
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
@@ -32,9 +31,8 @@ class Organizations::TeamsController < Organizations::BaseController
|
||||
end
|
||||
|
||||
def destroy
|
||||
tip_exception("您没有权限进行该操作") unless @organization.is_owner?(current_user)
|
||||
ActiveRecord::Base.transaction do
|
||||
Gitea::Organization::Team::DeleteService.call(current_user.gitea_token, @team.gtid)
|
||||
Gitea::Organization::Team::DeleteService.call(@organization.gitea_token, @team.gtid)
|
||||
@team.destroy!
|
||||
end
|
||||
render_ok
|
||||
|
||||
Reference in New Issue
Block a user