@Commons@groovy.util.logging.Commons class Domain extends Object
管理域
应用分布式部署、分级管理时使用。
如果有多个应用在一个数据库上跑,则必须启用。
| Modifiers | Name | Description |
|---|---|---|
static String |
CODE_ROOT |
|
static String |
DEFAULT_NAME_PREFIX |
|
static Integer |
TYPE_ORG |
|
static Integer |
TYPE_USR |
| Type | Name and description |
|---|---|
static Object |
belongsTo上级域 |
String |
code编码,如HQ |
static Object |
constraints |
String |
createdBy |
Date |
dateCreated时间戳... |
Boolean |
disabled是否禁用 |
String |
empHQL基于员工的动态域的HQL片段: emp表示员工 |
String |
fullName域全名 |
static Object |
hasMany域管理员、下级域、应用程序 |
Date |
lastUpdated |
Integer |
level域级别:从0开始 |
static Map |
listFields |
static Object |
mapping |
String |
name名称 |
String |
notes备注 |
Organization |
organization机构:空则表示根域 或者 基于员工的动态域 |
String |
parentIds所有上级域的ID列表:冗余数据,多个ID间以分号分隔,级别从高到低排列 |
Integer |
type类型 |
String |
updatedBy |
| Type | Name and description |
|---|---|
Object |
beforeInsert()自动更新fullName、level、parentIds |
Object |
beforeUpdate() |
static Domain |
current()根据配置 bropen.framework.security.domain.current,获得当前 Domain |
static Long |
currentId()获得当前应用所属的域 ID |
static Domain |
findByOrganizationId(Long organizationId, boolean disabledInclude = false)根据机构 ID 查找域 |
static String |
getEmpHQL(Long userId, String replacement = null)计算用户管理的基于员工的动态域的HQL串 |
static Map |
getListFieldMapping(boolean mappingField = true, boolean testDomainEnable = false)domain 或 domainId 字段在列表定义(request.listFields)中的基本设置 |
static List<Long> |
getManagedDomainIds(Long userId)获得用户所管理的所有域的ID(不含下级域) |
static List<Domain> |
getManagedDomains(User user)获得用户所管理的所有域(不含下级域) |
static List<Long> |
getManagedOrganizationIds(Long userId)获得用户所管理的所有机构ID |
static List<Organization> |
getManagedOrganizations(Long userId)获得用户所管理的所有机构 |
static List<Domain> |
getRelatedDomains(Employee employee)获得用户参与的、类型为机构的所有域,不存在则返回空列表 |
static Domain |
initCurrent()系统启动时,初始化根域及应用程序 |
static boolean |
isAdmin(User user, Domain domain)判断用户是否有权管理某个域 |
static boolean |
isAdmin(User user, String domainCode)判断用户是否有权管理某个域 |
static boolean |
isAdmin(User user, Integer type = null)判断用户是否为域管理员 |
static boolean |
isApplicationAdmin(Long userId, Long applicationId)判断用户是否有权管理某个域应用程序 |
static boolean |
isDomainAdministrationEnabled()是否启用了域管理 |
static boolean |
isOrganizationAdmin(Long userId, Long orgId)判断用户是否有权管理某个机构下的资源 |
static boolean |
removeAdminRole(Collection<User> admins)删除域的管理员、或删除域后,取消管理员角色 |
static void |
setAdminRole(Collection<User> admins)域管理员指定后,关联角色 |
String |
toString() |
| Methods inherited from class | Name |
|---|---|
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
上级域
编码,如HQ
时间戳...
是否禁用
基于员工的动态域的HQL片段: emp表示员工
域全名
域管理员、下级域、应用程序
域级别:从0开始
名称
备注
机构:空则表示根域 或者 基于员工的动态域
所有上级域的ID列表:冗余数据,多个ID间以分号分隔,级别从高到低排列
类型
自动更新fullName、level、parentIds
根据配置 bropen.framework.security.domain.current,获得当前 Domain
获得当前应用所属的域 ID
根据机构 ID 查找域
organizationId - 机构 IDdisabledInclude - 是否包含已禁用的域,默认为否计算用户管理的基于员工的动态域的HQL串
userId - 域管理员用户IDreplacement - 用于替换 hql 中的参数 emp 的 hql 片段,如 t.actordomain 或 domainId 字段在列表定义(request.listFields)中的基本设置
mappingField - 如果关联 Domain 对象,则设为 true (默认),否则(如关联 domainId)请设置为 falsetestDomainEnable - 如果仅当启用域管理才显示,则设置为 true,否则请设置为 false(默认)获得用户所管理的所有域的ID(不含下级域)
userId - 用户ID获得用户所管理的所有域(不含下级域)
user - 用户。如果为空,则取当前用户获得用户所管理的所有机构ID
userId - 用户ID获得用户所管理的所有机构
userId - 用户ID获得用户参与的、类型为机构的所有域,不存在则返回空列表
系统启动时,初始化根域及应用程序
判断用户是否有权管理某个域
user - 用户。如果为空,则取当前用户domain - 域对象判断用户是否有权管理某个域
user - 用户。如果为空,则取当前用户domain - 域的Code判断用户是否为域管理员
user - 用户。如果为空,则取当前用户判断用户是否有权管理某个域应用程序
userId - 用户ID,空则取当前用户的idapplicationId - 应用程序ID是否启用了域管理
判断用户是否有权管理某个机构下的资源
userId - 用户ID,空则取当前用户的idapplicationId - 应用程序ID删除域的管理员、或删除域后,取消管理员角色
admins - 管理员用户列表域管理员指定后,关联角色
admins - 管理员用户列表