cloudIDE saas定制api

This commit is contained in:
“xxq250” 2022-10-12 15:37:22 +08:00
parent a516363763
commit e7bbe252de
4 changed files with 34 additions and 0 deletions

View File

@ -109,6 +109,19 @@ class UsersController < ApplicationController
@user = current_user
end
# cloudIDE saas定制
def info
@code = 1001
@message = "用户不存在"
if params[:token].present?
@user = User.try_to_autologin(params[:token])
if @user.present?
@code = 1000
@message = "success"
end
end
end
# 贴吧获取用户信接口
def get_user_info
begin

View File

@ -65,6 +65,7 @@ module ProjectsHelper
license_id: project.license_id,
jianmu_devops: jianmu_devops_code(project, user),
jianmu_devops_url: jianmu_devops_url,
cloud_ide_saas_url: cloud_ide_saas_url(user),
ignore_id: project.ignore_id
}).compact
@ -128,6 +129,14 @@ module ProjectsHelper
EduSetting.get("jianmu_devops_url") || "https://ci-v3.test.jianmuhub.com"
end
def cloud_ide_saas_url(user)
token = Token.get_token_from_user(user, "autologin")
oauth_url = "#{Rails.application.config_for(:configuration)['platform_url']}/api/users/info.json"
saas_url = EduSetting.get("cloud_ide_saas_url") || "https://saasfactory.test.opentrs.com"
"#{saas_url}/oauth/login?product_account_id=PA1001218&tenant_code=TI1001383&oauth_url=#{oauth_url}&token=#{token}"
end
def aes_encrypt(key, des_text)
# des_text='{"access_key_id":"STS.NTuC9RVmWfJqj3JkcMzPnDf7X","access_key_secret":"E8NxRZWGNxxMfwgt5nFLnBFgg6AzgXCZkSNCyqygLuHM","end_point":"oss-accelerate.aliyuncs.com","security_token":"CAIS8gF1q6Ft5B2yfSjIr5fACIPmu7J20YiaaBX7j2MYdt9Cq6Ocujz2IHhMenVhA+8Wv/02n2hR7PcYlq9IS55VWEqc/VXLaywQo22beIPkl5Gfz95t0e+IewW6Dxr8w7WhAYHQR8/cffGAck3NkjQJr5LxaTSlWS7OU/TL8+kFCO4aRQ6ldzFLKc5LLw950q8gOGDWKOymP2yB4AOSLjIx6lAt2T8vs/7hmZPFukSFtjCglL9J/baWC4O/csxhMK14V9qIx+FsfsLDqnUIs0YWpf0p3P0doGyf54vMWUM05A6dduPS7txkLAJwerjVl1/ADxc0/hqAASXhPeiktbmDjwvnSn4iKcSGQ+xoQB468eHXNdvf13dUlbbE1+JhRi0pZIB2UCtN9oTsLHcwIHt+EJaoMd3+hGwPVmvHSXzECDFHylZ8l/pzTwlE/aCtZyVmI5cZEvmWu2xBa3GRbULo7lLvyeX1cHTVmVWf4Nk6D09PzTU8qlAj","bucket":"edu-bigfiles1","region":"oss-cn-hangzhou","callback_url":"https://data.educoder.net/api/buckets/callback.json","bucket_host":"data.educoder.net"}'
# des = OpenSSL::Cipher::Cipher.new('aes-256-ctr')

View File

@ -0,0 +1,11 @@
json.code @code
json.message @message
json.userInfoBo do
json.name @user.real_name
json.userEmail @user.mail
json.phone @user.phone
json.login @user.login
json.user_id @user.id
json.image_url url_to_avatar(@user)
json.admin @user.admin
end

View File

@ -258,6 +258,7 @@ Rails.application.routes.draw do
post :attendance
get :system_update
get :me
get :info
get :list
post :sync_token
post :sync_gitea_pwd