支持cloud_admin(space._id) 工作区
已关闭
支持cloud_admin(space._id) 工作区
Created by: baozhoutao
Created by: baozhoutao
function createSpace(userId, spaceId, spaceName){ var userDoc = db.users.findOne({_id: userId}) var now = new Date(); db.spaces.insert( { _id: spaceId, space: spaceId, name: spaceName, admins: [userId], owner: userId, created_by: userId, created: now, modified_by: userId, modified: now }); var spaceDoc = db.spaces.findOne({_id: spaceId}); var companyId = ObjectId().str db.company.insert({ _id: companyId, name: spaceDoc.name, space: spaceDoc._id, organization: companyId, company_id: companyId, owner: userId, created_by: userId, created: now, modified_by: userId, modified: now }); db.organizations.insert( { _id: companyId, name: spaceDoc.name, fullname: spaceDoc.name, is_company: true, users: [userId], company_id: companyId, space: spaceDoc._id, owner: userId, created_by: userId, created: now, modified_by: userId, modified: now } ); db.space_users.insert({ _id: ObjectId().str, user: userDoc._id, username: userDoc.username, name: userDoc.name, email: userDoc.email, user_accepted: true, organization: companyId, organizations: [companyId], organizations_parents: [companyId], company_id: companyId, company_ids: [companyId], space: spaceDoc._id, owner: userId, created_by: userId, created: now, modified_by: userId, modified: now }); } createSpace("5194c66ef4a563537a000003", "cloud_admin", '云管理');
云平台需执行此脚本创建cloud_admin工作区
请注册或登录再回复