diff --git a/src/main/java/com/rebuild/server/bizz/privileges/SecurityManager.java b/src/main/java/com/rebuild/server/bizz/privileges/SecurityManager.java index ec4ec9391..8f5392a24 100644 --- a/src/main/java/com/rebuild/server/bizz/privileges/SecurityManager.java +++ b/src/main/java/com/rebuild/server/bizz/privileges/SecurityManager.java @@ -28,7 +28,6 @@ import cn.devezhao.bizz.privileges.Privileges; import cn.devezhao.bizz.privileges.impl.BizzDepthEntry; import cn.devezhao.bizz.privileges.impl.BizzPermission; import cn.devezhao.bizz.security.member.Role; -import cn.devezhao.bizz.security.member.User; import cn.devezhao.persist4j.engine.ID; /** @@ -71,8 +70,14 @@ public class SecurityManager { * @return */ public Privileges getPrivileges(ID user, int entity) { - Role role = USER_STORE.getUser(user).getOwningRole(); - return role.getPrivileges(entity); + User u = USER_STORE.getUser(user); + if (!u.isActive()) { + return Privileges.NONE; + } + if (u.isAdmin()) { + return Privileges.ROOT; + } + return u.getOwningRole().getPrivileges(entity); } /** diff --git a/src/main/webapp/assets/css/rb-page.css b/src/main/webapp/assets/css/rb-page.css index 73b8172c4..66eae547f 100644 --- a/src/main/webapp/assets/css/rb-page.css +++ b/src/main/webapp/assets/css/rb-page.css @@ -483,6 +483,7 @@ a { .data-list .table thead th>div { color: #555; position: relative; + text-overflow: ellipsis; } .data-list .table thead th>div>i { @@ -493,7 +494,7 @@ a { } .data-list .table thead th>div>i.split { - width: 6px; + width: 8px; border-right: 2px dotted #aaa; cursor: e-resize; } diff --git a/src/main/webapp/assets/js/rb-base.js b/src/main/webapp/assets/js/rb-base.js index abd933f6e..58af5984c 100644 --- a/src/main/webapp/assets/js/rb-base.js +++ b/src/main/webapp/assets/js/rb-base.js @@ -183,8 +183,23 @@ const $regex = { }; const $encode = function(s) { - return encodeURIComponent(s); + return encodeURIComponent(s) } const $decode = function(s) { - return decodeURIComponent(s); + return decodeURIComponent(s) +} + +const $storage = { + get(key){ + if (window.localStorage) return localStorage.getItem(key) + else return $.cookie(key) + }, + set(key, val){ + if (window.localStorage) localStorage.setItem(key, val) + else $.cookie(key, val, { expires:365 }) + }, + remove(key){ + if (window.localStorage) localStorage.removeItem(key) + else $.removeCookie(key) + } } \ No newline at end of file diff --git a/src/main/webapp/assets/js/rb-list.jsx b/src/main/webapp/assets/js/rb-list.jsx index c3d1e4c96..cd68613e6 100644 --- a/src/main/webapp/assets/js/rb-list.jsx +++ b/src/main/webapp/assets/js/rb-list.jsx @@ -2,7 +2,17 @@ class RbList extends React.Component { constructor(props) { super(props) + + this.__sortFieldKey = 'SortField-' + this.props.config.entity + this.__columnWidthKey = 'ColumnWidth-' + this.props.config.entity + '.' + + let sort = ($storage.get(this.__sortFieldKey) || ':').split(':') let fields = props.config.fields + for (let i = 0; i < fields.length; i++){ + let cw = $storage.get(this.__columnWidthKey + fields[i].field) + if (!!cw && ~~cw > 40) fields[i].width = ~~cw + if (sort[0] == fields[i].field) fields[i].sort = sort[1] + } props.config.fields = null this.state = { ...props, fields: fields, rowData: [], noData: false, checkedAll: false, pageNo: 1, pageSize: 20 } @@ -31,7 +41,7 @@ class RbList extends React.Component { let columnWidth = (item.width || that.__defaultColumnWidth) + 'px' let styles = { width: columnWidth } let sortClazz = item.sort || '' - return (
{item.label}
) + return (
{item.label}
) })} @@ -63,18 +73,18 @@ class RbList extends React.Component { let that = this scroller.find('th .split').draggable({ containment: '.rb-datatable-body', axis: 'x', helper: 'clone', stop: function(event, ui){ - let field = $(event.target).parent().parent().data('field') - let left = ui.position.left - 4; - if (left < 40) left = 40 + let field = $(event.target).data('field') + let left = ui.position.left - 2 + if (left < 40) left = 40 // min let fields = that.state.fields for (let i = 0; i < fields.length; i++){ if (fields[i].field == field){ fields[i].width = left - break; + $storage.set(that.__columnWidthKey + field, left) + break } } - that.setState({ fields: fields }, function(){ - }) + that.setState({ fields: fields }) }}) this.fetchList() } @@ -140,15 +150,17 @@ class RbList extends React.Component { let styles = { width: (this.state.fields[index].width || this.__defaultColumnWidth) + 'px' } if (field.type == 'IMAGE') { cellVal = JSON.parse(cellVal || '[]') - return
{cellVal.map((item)=>{ - return - })}
+ return (
+ {cellVal.map((item)=>{ + return + })}
) } else if (field.type == 'FILE') { cellVal = JSON.parse(cellVal || '[]') - return
    {cellVal.map((item)=>{ - let fileName = __fileCutName(item) - return
  • {fileName}
  • - })}
; + return (
    + {cellVal.map((item)=>{ + let fileName = __fileCutName(item) + return
  • {fileName}
  • + })}
) } else if (field.type == 'REFERENCE'){ return
this.clickView(cellVal)}>{cellVal[1]}
} else if (field.field == this.props.config.nameField){ @@ -235,8 +247,9 @@ class RbList extends React.Component { let fields = this.state.fields; for (let i = 0; i < fields.length; i++){ if (fields[i].field == field){ - if (fields[i].sort == 'sort-asc') fields[i].sort = 'sort-desc'; - else fields[i].sort = 'sort-asc'; + if (fields[i].sort == 'sort-asc') fields[i].sort = 'sort-desc' + else fields[i].sort = 'sort-asc' + $storage.set(this.__sortFieldKey, field + ':' + fields[i].sort) } else { fields[i].sort = null } @@ -274,8 +287,8 @@ class RbListPagination extends React.Component {