认证功能

dev_home
daiao 5 years ago
parent 7605c467dd
commit d167bfca64

@ -49,8 +49,7 @@ class GitsController < ApplicationController
shixunname = git_url.split("/")[1].split(".")[0]
repo_name = username + "/" + shixunname
uid_logger("git start: repo_name is #{repo_name}")
user_id = User.find_by_login(username)
shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name, user_id: user_id).first
shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name, laboratory_id: nil).first
uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}")
uid_logger("git start auth: systemuser is #{system_user.try(:login)}")

@ -62,6 +62,9 @@ class Subjects::CopySubjectService < ApplicationService
'use_scope', 'averge_star', 'myshixuns_count')
to_shixun.identifier = Util::UUID.generate_identifier(Shixun, 8)
to_shixun.user_id = user_id
if laboratory
to_shixun.laboratory_id = laboratory.id
end
to_shixun.save!
copy_shixun_info_data!(shixun, to_shixun)
@ -72,7 +75,9 @@ class Subjects::CopySubjectService < ApplicationService
copy_shixun_members_data!(to_shixun)
# 云上实验室
laboratory.laboratory_shixuns.create(shixun: to_shixun) if laboratory
if laboratory
laboratory.laboratory_shixuns.create(shixun: to_shixun)
end
to_shixun
end

@ -0,0 +1,5 @@
class AddLaboraryIdForShixun < ActiveRecord::Migration[5.2]
def change
add_column :shixuns, :laboratory_id, :integer
end
end
Loading…
Cancel
Save