Skip to content

Commit

Permalink
bc: 放开部分超管操作
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Jan 23, 2025
1 parent 057f37d commit b6c82af
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 49 deletions.
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from f5a2d1 to 408337
2 changes: 0 additions & 2 deletions src/main/java/com/rebuild/core/metadata/impl/CopyEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.rebuild.core.rbstore.MetaschemaImporter;
import com.rebuild.core.support.task.TaskExecutors;
import com.rebuild.utils.CommonsUtils;
import com.rebuild.utils.RbAssert;
import org.apache.commons.lang.StringUtils;

/**
Expand All @@ -42,7 +41,6 @@ public CopyEntity(Entity sourceEntity) {
*/
public String copy(String entityName, String detailName) {
final ID user = getUser();
RbAssert.isSuperAdmin(user);

// 导出

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/rebuild/core/metadata/impl/ExcelEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.RbAssert;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;

Expand All @@ -28,9 +27,6 @@ public class ExcelEntity extends Entity2Schema {
* @return
*/
public String imports(String entityName, JSONArray fields) {
final ID user = getUser();
RbAssert.isSuperAdmin(user);

// 1.实体
String uniqueEntityName = createEntity(null, entityName, null, null, false, false);
Entity entityNew = MetadataHelper.getEntity(uniqueEntityName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.rebuild.core.support.setup.Installer;
import com.rebuild.utils.BlockList;
import com.rebuild.utils.CommonsUtils;
import com.rebuild.utils.RbAssert;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.CharSet;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -77,13 +76,6 @@ public Field2Schema(ID user) {
super.setUser(user);
}

@Override
public ID getUser() {
ID user = super.getUser();
RbAssert.isSuperAdmin(user);
return user;
}

/**
* @param entity
* @param fieldLabel
Expand Down
22 changes: 9 additions & 13 deletions src/main/resources/web/admin/metadata/entities.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,16 @@
.find('a.card')
.attr('href', 'javascript:;')
.on('click', function () {
if (window.__PageConfig.isSuperAdmin) {
if (_EntityNew2) {
_EntityNew2.show()
} else {
renderRbcomp18(
<EntityNew2
ref={function (o) {
_EntityNew2 = o
}}
/>
)
}
if (_EntityNew2) {
_EntityNew2.show()
} else {
RbHighbar.error('仅超级管理员可添加实体')
renderRbcomp18(
<EntityNew2
ref={function (o) {
_EntityNew2 = o
}}
/>
)
}
})
.find('.more-action')
Expand Down
10 changes: 0 additions & 10 deletions src/main/resources/web/assets/js/metadata/entity-advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ $(document).ready(() => {

$('.J_drop-confirm').on('click', () => {
if (!$('.J_drop-check').prop('checked')) return
if (!window.__PageConfig.isSuperAdmin) {
RbHighbar.error($L('仅超级管理员可删除实体'))
return
}

RbAlert.create($L('实体删除后将无法恢复,请务必谨慎操作。确认删除吗?'), $L('删除实体'), {
type: 'danger',
confirmText: $L('删除'),
Expand All @@ -54,11 +49,6 @@ $(document).ready(() => {
})
$('.J_truncate-confirm').on('click', () => {
if (!$('.J_drop-check').prop('checked')) return
if (!window.__PageConfig.isSuperAdmin) {
RbHighbar.error($L('仅超级管理员可清空数据'))
return
}

RbAlert.create($L('此操作将直接清空数据,不会保留在回收站及触发相关业务规则。'), $L('清空数据'), {
type: 'danger',
confirmText: $L('清空'),
Expand Down
5 changes: 0 additions & 5 deletions src/main/resources/web/assets/js/metadata/field-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,6 @@ $(document).ready(function () {
// delete extConfig['stateClass']

$('.J_del').on('click', function () {
if (!wpc.isSuperAdmin) {
RbHighbar.error($L('仅超级管理员可删除字段'))
return
}

RbAlert.create($L('字段删除后将无法恢复,请务必谨慎操作。确认删除吗?'), $L('删除字段'), {
type: 'danger',
confirmText: $L('删除'),
Expand Down
6 changes: 2 additions & 4 deletions src/main/resources/web/assets/js/metadata/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ $(document).ready(() => {
})
$('.J_new-field').on('click', () => {
// eslint-disable-next-line react/jsx-no-undef
if (wpc.isSuperAdmin) renderRbcomp18(<FieldNew2 entity={wpc.entityName} />)
else RbHighbar.error($L('仅超级管理员可添加字段'))
renderRbcomp18(<FieldNew2 entity={wpc.entityName} />)
})

$('.J_new9-field').on('click', () => {
if (wpc.isSuperAdmin) RbModal.create(`/p/admin/metadata/field-new9?entity=${wpc.entityName}`, $L('批量添加字段'), { width: 1064 })
else RbHighbar.error($L('仅超级管理员可添加字段'))
RbModal.create(`/p/admin/metadata/field-new9?entity=${wpc.entityName}`, $L('批量添加字段'), { width: 1064 })
})

$('.J_export-fields').on('click', exportFields)
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/web/assets/js/metadata/form-design.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,7 @@ const render_type = function (fieldType) {
const $item = $(`<li class="dd-item"><div class="dd-handle"><i class="icon mdi ${fieldType.icon || 'mdi-form-textbox'}"></i> ${$L(fieldType.label)}</div></li>`).appendTo('.type-list')
$item.on('click', function () {
// eslint-disable-next-line react/jsx-no-undef
if (wpc.isSuperAdmin) renderRbcomp(<FieldNew2 entity={wpc.entityName} fieldType={fieldType.name} />)
else RbHighbar.error($L('仅超级管理员可添加字段'))
renderRbcomp(<FieldNew2 entity={wpc.entityName} fieldType={fieldType.name} />)
})
return $item
}
Expand Down

0 comments on commit b6c82af

Please sign in to comment.