@steedos/ee_branding 2.2.52-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/main/default/manager/spaces.js +38 -0
- package/main/default/objectTranslations/spaces.en/spaces.en.objectTranslation.yml +30 -0
- package/main/default/objectTranslations/spaces.zh-CN/spaces.zh-CN.objectTranslation.yml +30 -0
- package/main/default/objects/spaces/fields/account_logo.field.yml +4 -0
- package/main/default/objects/spaces/fields/avatar.field.yml +4 -0
- package/main/default/objects/spaces/fields/avatar_dark.field.yml +6 -0
- package/main/default/objects/spaces/fields/avatar_square.field.yml +5 -0
- package/main/default/objects/spaces/fields/background.field.yml +4 -0
- package/main/default/objects/spaces/fields/favicon.field.yml +5 -0
- package/main/default/objects/spaces/spaces.object.yml +2 -0
- package/main/default/triggers/spaces.trigger.js +23 -0
- package/package.json +14 -0
- package/package.service.js +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: sunhaolin@hotoa.com
|
|
3
|
+
* @Date: 2022-07-01 14:07:26
|
|
4
|
+
* @LastEditors: sunhaolin@hotoa.com
|
|
5
|
+
* @LastEditTime: 2022-07-01 14:30:18
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
const { isPlatformEnterPrise } = require('@steedos/license')
|
|
11
|
+
const LOGO_FIELDS = ['account_logo', 'avatar_dark', 'avatar_square', 'avatar', 'background', 'favicon']
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 只有企业版才能更改Logo
|
|
15
|
+
* @param {*} triggerContext
|
|
16
|
+
*/
|
|
17
|
+
async function checkIsEnterprise(triggerContext) {
|
|
18
|
+
const { doc, spaceId } = triggerContext;
|
|
19
|
+
if (spaceId) {
|
|
20
|
+
let needToCheck = false
|
|
21
|
+
for (const fieldName of LOGO_FIELDS) {
|
|
22
|
+
if (doc[fieldName]) {
|
|
23
|
+
needToCheck = true
|
|
24
|
+
break
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (needToCheck) {
|
|
28
|
+
const allow = await isPlatformEnterPrise(spaceId)
|
|
29
|
+
if (!allow) {
|
|
30
|
+
throw new Error('need_platfrom_enterprise');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
checkIsEnterprise
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: spaces
|
|
2
|
+
fields:
|
|
3
|
+
avatar:
|
|
4
|
+
label: Logo
|
|
5
|
+
help:
|
|
6
|
+
description:
|
|
7
|
+
avatar_square:
|
|
8
|
+
label: Square Logo
|
|
9
|
+
help:
|
|
10
|
+
description:
|
|
11
|
+
avatar_dark:
|
|
12
|
+
label: Dark Logo
|
|
13
|
+
help:
|
|
14
|
+
description:
|
|
15
|
+
account_logo:
|
|
16
|
+
label: Account logo
|
|
17
|
+
help:
|
|
18
|
+
description:
|
|
19
|
+
background:
|
|
20
|
+
label: Background
|
|
21
|
+
help:
|
|
22
|
+
description:
|
|
23
|
+
favicon:
|
|
24
|
+
label: Favicon
|
|
25
|
+
help:
|
|
26
|
+
description:
|
|
27
|
+
groups:
|
|
28
|
+
branding: Branding
|
|
29
|
+
CustomLabels:
|
|
30
|
+
need_platfrom_enterprise: Only the enterprise version can change the logo
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: spaces
|
|
2
|
+
fields:
|
|
3
|
+
avatar:
|
|
4
|
+
label: Logo
|
|
5
|
+
help:
|
|
6
|
+
description:
|
|
7
|
+
avatar_square:
|
|
8
|
+
label: 正方形Logo
|
|
9
|
+
help:
|
|
10
|
+
description:
|
|
11
|
+
avatar_dark:
|
|
12
|
+
label: 深色Logo
|
|
13
|
+
help:
|
|
14
|
+
description:
|
|
15
|
+
account_logo:
|
|
16
|
+
label: 登录页Logo
|
|
17
|
+
help:
|
|
18
|
+
description:
|
|
19
|
+
background:
|
|
20
|
+
label: 登录页背景图
|
|
21
|
+
help:
|
|
22
|
+
description:
|
|
23
|
+
favicon:
|
|
24
|
+
label: 浏览器标签页图标
|
|
25
|
+
help:
|
|
26
|
+
description:
|
|
27
|
+
groups:
|
|
28
|
+
branding: 自定义品牌
|
|
29
|
+
CustomLabels:
|
|
30
|
+
need_platfrom_enterprise: 只有企业版才能更改Logo
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: sunhaolin@hotoa.com
|
|
3
|
+
* @Date: 2022-07-01 14:05:45
|
|
4
|
+
* @LastEditors: sunhaolin@hotoa.com
|
|
5
|
+
* @LastEditTime: 2022-07-01 14:40:48
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
checkIsEnterprise
|
|
11
|
+
} = require('../manager/spaces')
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
listenTo: "spaces",
|
|
15
|
+
|
|
16
|
+
beforeInsert: async function () {
|
|
17
|
+
await checkIsEnterprise(this)
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
beforeUpdate: async function () {
|
|
21
|
+
await checkIsEnterprise(this)
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@steedos/ee_branding",
|
|
3
|
+
"version": "2.2.52-beta.22",
|
|
4
|
+
"main": "package.service.js",
|
|
5
|
+
"scripts": {},
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"private": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@steedos/license": "2.2.5"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: sunhaolin@hotoa.com
|
|
3
|
+
* @Date: 2022-05-03 10:29:51
|
|
4
|
+
* @LastEditors: sunhaolin@hotoa.com
|
|
5
|
+
* @LastEditTime: 2022-07-01 13:20:01
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
"use strict";
|
|
9
|
+
const project = require('./package.json');
|
|
10
|
+
const packageName = project.name;
|
|
11
|
+
const packageLoader = require('@steedos/service-package-loader');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {import('moleculer').Context} Context Moleculer's Context
|
|
15
|
+
*/
|
|
16
|
+
module.exports = {
|
|
17
|
+
name: packageName,
|
|
18
|
+
namespace: "steedos",
|
|
19
|
+
mixins: [packageLoader],
|
|
20
|
+
/**
|
|
21
|
+
* Settings
|
|
22
|
+
*/
|
|
23
|
+
settings: {
|
|
24
|
+
packageInfo: {
|
|
25
|
+
path: __dirname,
|
|
26
|
+
name: packageName
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Dependencies
|
|
32
|
+
*/
|
|
33
|
+
dependencies: ['~packages-standard-objects'],
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Actions
|
|
37
|
+
*/
|
|
38
|
+
actions: {
|
|
39
|
+
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Events
|
|
44
|
+
*/
|
|
45
|
+
events: {
|
|
46
|
+
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Methods
|
|
51
|
+
*/
|
|
52
|
+
methods: {
|
|
53
|
+
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
merged(schema) {
|
|
57
|
+
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Service created lifecycle event handler
|
|
62
|
+
*/
|
|
63
|
+
async created() {
|
|
64
|
+
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Service started lifecycle event handler
|
|
69
|
+
*/
|
|
70
|
+
async started() {
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Service stopped lifecycle event handler
|
|
76
|
+
*/
|
|
77
|
+
async stopped() {
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
};
|