1. 执行计划:自动执行上下文没有当前组织信息,给上下文加上组织信息
using Kingdee.BOS.BusinessEntity.Organizations;
using Kingdee.BOS.ServiceHelper;
Organization curOrg = OrganizationServiceHelper.ReadOrgInfoByOrgId(ctx, 1); //管理员默认组织
List<long> functions = new List<long>();
if (!curOrg.OrgFunctions.IsNullOrEmptyOrWhiteSpace())
{
functions = Array.ConvertAll(curOrg.OrgFunctions.Split(','), (a) => { return Convert.ToInt64(a); }).ToList();
}
var CurrentOrganizationInfo = new OrganizationInfo() { ID = curOrg.Id, Name = curOrg.Name,
FunctionIds = functions, AcctOrgType = curOrg.AcctOrgType };
2. 得到用户所有组织,查询用户配置的组织
var lstOrgs= PermissionServiceHelper.GetUserOrg(this.Context)
3. 查询用户在表单中有权限的组织,用户--》组织--》角色--》有权限
using Kingdee.BOS.Core.Permission;
using Kingdee.BOS.ServiceHelper;
var form = this.View.BillBusinessInfo.GetForm();
if (form.SupportPermissionControl == 1)
{
BusinessObject bObj = new BusinessObject();
bObj.Id = form.Id;
var lstOrgPkIds = PermissionServiceHelper.GetPermissionOrg(this.View.Context, bObj, PermissionConst.New);
}