No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
1 | 1 | /* |
|
2 | - | rebuild - Building your business-systems freely. |
|
3 | - | Copyright (C) 2018 devezhao <zhaofang123@gmail.com> |
|
2 | + | Copyright (c) REBUILD <https://getrebuild.com/> and its owners. All rights reserved. |
|
4 | 3 | ||
5 | - | This program is free software: you can redistribute it and/or modify |
|
6 | - | it under the terms of the GNU General Public License as published by |
|
7 | - | the Free Software Foundation, either version 3 of the License, or |
|
8 | - | (at your option) any later version. |
|
9 | - | ||
10 | - | This program is distributed in the hope that it will be useful, |
|
11 | - | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | - | GNU General Public License for more details. |
|
14 | - | ||
15 | - | You should have received a copy of the GNU General Public License |
|
16 | - | along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
4 | + | rebuild is dual-licensed under commercial and open source licenses (GPLv3). |
|
5 | + | See LICENSE and COMMERCIAL in the project root for license information. |
|
17 | 6 | */ |
|
18 | 7 | ||
19 | 8 | package com.rebuild.server.configuration.portals; |
112 | 101 | Field parentField = entityMeta.getField(fieldPath[0]); |
|
113 | 102 | if (!filter) { |
|
114 | 103 | formatted = formatField(lastField, parentField); |
|
115 | - | } else if (Application.getSecurityManager().allowRead(user, lastField.getOwnEntity().getEntityCode())) { |
|
104 | + | } else if (Application.getPrivilegesManager().allowRead(user, lastField.getOwnEntity().getEntityCode())) { |
|
116 | 105 | formatted = formatField(lastField, parentField); |
|
117 | 106 | } |
|
118 | 107 | } |
1 | 1 | /* |
|
2 | - | rebuild - Building your business-systems freely. |
|
3 | - | Copyright (C) 2018 devezhao <zhaofang123@gmail.com> |
|
2 | + | Copyright (c) REBUILD <https://getrebuild.com/> and its owners. All rights reserved. |
|
4 | 3 | ||
5 | - | This program is free software: you can redistribute it and/or modify |
|
6 | - | it under the terms of the GNU General Public License as published by |
|
7 | - | the Free Software Foundation, either version 3 of the License, or |
|
8 | - | (at your option) any later version. |
|
9 | - | ||
10 | - | This program is distributed in the hope that it will be useful, |
|
11 | - | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | - | GNU General Public License for more details. |
|
14 | - | ||
15 | - | You should have received a copy of the GNU General Public License |
|
16 | - | along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
4 | + | rebuild is dual-licensed under commercial and open source licenses (GPLv3). |
|
5 | + | See LICENSE and COMMERCIAL in the project root for license information. |
|
17 | 6 | */ |
|
18 | 7 | ||
19 | 8 | package com.rebuild.server.service; |
26 | 15 | import com.rebuild.server.Application; |
|
27 | 16 | import com.rebuild.server.helper.cache.NoRecordFoundException; |
|
28 | 17 | import com.rebuild.server.metadata.EntityHelper; |
|
18 | + | import org.apache.commons.logging.Log; |
|
19 | + | import org.apache.commons.logging.LogFactory; |
|
29 | 20 | import org.springframework.util.Assert; |
|
30 | 21 | ||
31 | 22 | import java.util.Iterator; |
|
23 | + | import java.util.List; |
|
32 | 24 | import java.util.Observable; |
|
25 | + | import java.util.Observer; |
|
33 | 26 | ||
34 | 27 | /** |
|
35 | 28 | * 可注入观察者的服务 |
39 | 32 | * |
|
40 | 33 | * @see OperatingObserver |
|
41 | 34 | */ |
|
42 | - | public abstract class ObservableService extends Observable implements EntityService { |
|
35 | + | public abstract class ObservableService extends Observable implements ServiceSpec { |
|
36 | + | ||
37 | + | private static final Log LOG = LogFactory.getLog(ObservableService.class); |
|
43 | 38 | ||
44 | 39 | /** |
|
45 | 40 | * 删除前触发的动作 |
|
46 | 41 | */ |
|
47 | 42 | public static final Permission DELETE_BEFORE = new BizzPermission("DELETE_BEFORE", 0, false); |
|
48 | 43 | ||
49 | - | final protected ServiceSpec delegate; |
|
44 | + | final protected ServiceSpec delegateService; |
|
50 | 45 | ||
51 | 46 | /** |
|
52 | 47 | * @param aPMFactory |
|
53 | 48 | */ |
|
54 | - | public ObservableService(PersistManagerFactory aPMFactory) { |
|
55 | - | this.delegate = new SystemEntityService(aPMFactory); |
|
49 | + | protected ObservableService(PersistManagerFactory aPMFactory) { |
|
50 | + | this(aPMFactory, null); |
|
51 | + | } |
|
52 | + | ||
53 | + | /** |
|
54 | + | * @param aPMFactory |
|
55 | + | * @param observers |
|
56 | + | */ |
|
57 | + | protected ObservableService(PersistManagerFactory aPMFactory, List<Observer> observers) { |
|
58 | + | this.delegateService = new BaseServiceImpl(aPMFactory); |
|
59 | + | ||
60 | + | // 注入观察者 @see application-ctx.xml |
|
61 | + | if (observers != null) { |
|
62 | + | for (Observer o : observers) { |
|
63 | + | addObserver(o); |
|
64 | + | LOG.info(this + " add observer : " + o); |
|
65 | + | } |
|
66 | + | } |
|
56 | 67 | } |
|
57 | 68 | ||
58 | 69 | @Override |
62 | 73 | ||
63 | 74 | @Override |
|
64 | 75 | public Record create(Record record) { |
|
65 | - | record = delegate.create(record); |
|
76 | + | record = delegateService.create(record); |
|
66 | 77 | ||
67 | 78 | if (countObservers() > 0) { |
|
68 | 79 | setChanged(); |
75 | 86 | public Record update(Record record) { |
|
76 | 87 | final Record before = countObservers() > 0 ? record(record) : null; |
|
77 | 88 | ||
78 | - | record = delegate.update(record); |
|
89 | + | record = delegateService.update(record); |
|
79 | 90 | ||
80 | 91 | if (countObservers() > 0) { |
|
81 | 92 | setChanged(); |
96 | 107 | notifyObservers(OperatingContext.create(Application.getCurrentUser(), DELETE_BEFORE, deleted, null)); |
|
97 | 108 | } |
|
98 | 109 | ||
99 | - | int affected = delegate.delete(recordId); |
|
110 | + | int affected = delegateService.delete(recordId); |
|
100 | 111 | ||
101 | 112 | if (countObservers() > 0) { |
|
102 | 113 | setChanged(); |
112 | 123 | * @return |
|
113 | 124 | */ |
|
114 | 125 | protected Record record(Record base) { |
|
115 | - | ID primary = base.getPrimary(); |
|
126 | + | final ID primary = base.getPrimary(); |
|
116 | 127 | Assert.notNull(primary, "Record primary not be bull"); |
|
117 | 128 | ||
118 | 129 | StringBuilder sql = new StringBuilder("select "); |
125 | 136 | ||
126 | 137 | Record current = Application.createQueryNoFilter(sql.toString()).setParameter(1, primary).record(); |
|
127 | 138 | if (current == null) { |
|
128 | - | throw new NoRecordFoundException("ID: " + primary); |
|
139 | + | throw new NoRecordFoundException("ID : " + primary); |
|
129 | 140 | } |
|
130 | 141 | return current; |
|
131 | 142 | } |
|
132 | - | ||
133 | - | /** |
|
134 | - | * @return |
|
135 | - | */ |
|
136 | - | protected ServiceSpec delegate() { |
|
137 | - | return delegate; |
|
138 | - | } |
|
139 | 143 | } |
37 | 37 | ||
38 | 38 | /** |
|
39 | 39 | * API 执行。 |
|
40 | - | * 处理失败应抛出 {@link ApiInvokeException} 异常(或其子类)或返回错误 ${@link #formatFailure(String)} |
|
40 | + | * 返回结果应该使用 #formatSuccess 或 #formatFailure 封装。或者也可以直接抛出 {@link ApiInvokeException} 异常 |
|
41 | 41 | * |
|
42 | 42 | * @param context |
|
43 | - | * @return #formatSuccess or #formatFailure |
|
43 | + | * @return Use #formatSuccess or #formatFailure |
|
44 | 44 | * @throws ApiInvokeException |
|
45 | 45 | */ |
|
46 | 46 | abstract public JSON execute(ApiContext context) throws ApiInvokeException; |
17 | 17 | import com.rebuild.server.Application; |
|
18 | 18 | import com.rebuild.server.ServerListener; |
|
19 | 19 | import com.rebuild.server.helper.language.Languages; |
|
20 | + | import com.rebuild.server.service.bizz.privileges.PrivilegesManager; |
|
20 | 21 | import com.rebuild.server.service.bizz.privileges.ZeroEntry; |
|
21 | 22 | import com.rebuild.web.admin.AdminEntryControll; |
|
22 | 23 | import org.apache.commons.lang.StringUtils; |
206 | 207 | * @param request |
|
207 | 208 | * @param entry |
|
208 | 209 | * @return |
|
209 | - | * @see com.rebuild.server.service.bizz.privileges.SecurityManager |
|
210 | + | * @see PrivilegesManager |
|
210 | 211 | */ |
|
211 | 212 | public static boolean allow(HttpServletRequest request, ZeroEntry entry) { |
|
212 | - | return Application.getSecurityManager().allow(getRequestUser(request), entry); |
|
213 | + | return Application.getPrivilegesManager().allow(getRequestUser(request), entry); |
|
213 | 214 | } |
|
214 | 215 | ||
215 | 216 | /** |
1 | 1 | /* |
|
2 | - | rebuild - Building your business-systems freely. |
|
3 | - | Copyright (C) 2018 devezhao <zhaofang123@gmail.com> |
|
2 | + | Copyright (c) REBUILD <https://getrebuild.com/> and its owners. All rights reserved. |
|
4 | 3 | ||
5 | - | This program is free software: you can redistribute it and/or modify |
|
6 | - | it under the terms of the GNU General Public License as published by |
|
7 | - | the Free Software Foundation, either version 3 of the License, or |
|
8 | - | (at your option) any later version. |
|
9 | - | ||
10 | - | This program is distributed in the hope that it will be useful, |
|
11 | - | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | - | GNU General Public License for more details. |
|
14 | - | ||
15 | - | You should have received a copy of the GNU General Public License |
|
16 | - | along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
4 | + | rebuild is dual-licensed under commercial and open source licenses (GPLv3). |
|
5 | + | See LICENSE and COMMERCIAL in the project root for license information. |
|
17 | 6 | */ |
|
18 | 7 | ||
19 | 8 | package com.rebuild.server.service.query; |
27 | 16 | import cn.devezhao.persist4j.query.NativeQuery; |
|
28 | 17 | import com.rebuild.server.Application; |
|
29 | 18 | import com.rebuild.server.metadata.MetadataHelper; |
|
30 | - | import com.rebuild.server.service.bizz.privileges.EntityQueryFilter; |
|
19 | + | import com.rebuild.server.service.bizz.privileges.RoleBaseQueryFilter; |
|
31 | 20 | import org.apache.commons.lang.StringUtils; |
|
32 | 21 | import org.springframework.util.Assert; |
|
33 | 22 |
36 | 25 | * |
|
37 | 26 | * @author zhaofang123@gmail.com |
|
38 | 27 | * @since 05/21/2017 |
|
28 | + | * @see RoleBaseQueryFilter |
|
39 | 29 | */ |
|
40 | 30 | public class QueryFactory { |
|
41 | 31 |
63 | 53 | * @return |
|
64 | 54 | */ |
|
65 | 55 | public Query createQuery(String ajql, ID user) { |
|
66 | - | return createQuery(ajql, Application.getSecurityManager().createQueryFilter(user)); |
|
56 | + | return createQuery(ajql, Application.getPrivilegesManager().createQueryFilter(user)); |
|
67 | 57 | } |
|
68 | 58 | ||
69 | 59 | /** |
|
70 | 60 | * @param ajql |
|
71 | 61 | * @return |
|
72 | 62 | */ |
|
73 | 63 | public Query createQueryNoFilter(String ajql) { |
|
74 | - | return createQuery(ajql, EntityQueryFilter.ALLOWED); |
|
64 | + | return createQuery(ajql, RoleBaseQueryFilter.ALLOWED); |
|
75 | 65 | } |
|
76 | 66 | ||
77 | 67 | /** |
Learn more Showing 31 files with coverage changes found.
src/main/java/com/rebuild/server/business/dataimport/ColumnWidthStrategy.java
src/main/java/com/rebuild/server/helper/cache/CommonCache.java
src/main/java/com/rebuild/server/helper/fieldvalue/ContentWithFieldVars.java
src/main/java/com/rebuild/utils/LocationUtils.java
src/main/java/com/rebuild/server/service/BaseService.java
src/main/java/com/rebuild/server/helper/KVStorage.java
src/main/java/com/rebuild/server/helper/task/HeavyTask.java
src/main/java/com/rebuild/server/metadata/MetadataHelper.java
src/main/java/com/rebuild/server/service/OperatingObserver.java
src/main/java/com/rebuild/server/helper/cache/BaseCacheTemplate.java
src/main/java/com/rebuild/server/helper/AesPreferencesConfigurer.java
src/main/java/com/rebuild/server/service/project/ProjectCommentService.java
src/main/java/com/rebuild/server/service/configuration/ProjectPlanConfigService.java
src/main/java/com/rebuild/utils/ExcelUtils.java
src/main/java/com/rebuild/server/service/project/BaseTaskService.java
src/main/java/com/rebuild/server/service/project/ProjectHelper.java
src/main/java/com/rebuild/server/business/trigger/impl/AutoApproval.java
src/main/java/com/rebuild/server/business/trigger/impl/TriggerByTimerJob.java
src/main/java/com/rebuild/server/service/configuration/ProjectConfigService.java
src/main/java/com/rebuild/server/service/project/ProjectTaskService.java
src/main/java/com/rebuild/utils/HttpUtils.java
src/main/java/com/rebuild/server/business/approval/ApprovalStatus.java
src/main/java/com/rebuild/server/configuration/ProjectManager.java
src/main/java/com/rebuild/server/service/bizz/privileges/UserStore.java
src/main/java/com/rebuild/server/service/bizz/privileges/PrivilegesManager.java
src/main/java/com/rebuild/server/configuration/ConfigEntry.java
src/main/java/com/rebuild/server/business/rbstore/RBStore.java
src/main/java/com/rebuild/api/metadata/FieldList.java
src/main/java/com/rebuild/server/service/CommonsService.java
src/main/java/com/rebuild/server/business/rbstore/ClassificationImporter.java
src/main/java/com/rebuild/server/service/bizz/TeamService.java
#211
d7260e1
7e9b7f8
a5751df
4bd2e4a
ccc6f07
4780098
24e7886
ffa3e9c
ee0f0b6
72c523e
1f80f74
99cecf4
d32958a
92eff67
e615730
3301048
eb9a75b
1a2afa9
a058447
38e11ef
6927c78
5d9ae27
e6d2b65
a234d65
3d963d2
6ca4646
5961e51
7080380
c6e5e54
c608df2
c3eb3d0
199e4af