Example #1
0
        public CDesktopGroupAccessInRole FindByDesktopGroup(Guid UI_DesktopGroup_id)
        {
            List <CBaseObject> lstObj = GetList();

            foreach (CBaseObject obj in lstObj)
            {
                CDesktopGroupAccessInRole dgair = (CDesktopGroupAccessInRole)obj;
                if (dgair.UI_DesktopGroup_id == UI_DesktopGroup_id)
                {
                    return(dgair);
                }
            }
            return(null);
        }
Example #2
0
        //获取用户桌面组权限
        //可写优先,只读次之,禁止最后
        public AccessType GetDesktopGroupAccess(Guid UI_DesktopGroup_id)
        {
            //管理员有所有权限
            if (IsRole("管理员"))
            {
                return(AccessType.write);
            }
            //
            AccessType accessType           = AccessType.forbide;
            CDesktopGroupAccessInUser dgaiu = DesktopGroupAccessInUserMgr.FindByDesktopGroup(UI_DesktopGroup_id);

            if (dgaiu != null)
            {
                accessType = dgaiu.Access;
                if (accessType == AccessType.write)
                {
                    return(AccessType.write);
                }
            }

            CCompany           Company = (CCompany)Ctx.CompanyMgr.Find(B_Company_id);
            List <CBaseObject> lstObj  = Company.RoleMgr.GetList();

            foreach (CBaseObject obj in lstObj)
            {
                CRole role = (CRole)obj;
                if (role.UserInRoleMgr.FindByUserid(Id) != null)
                {
                    CDesktopGroupAccessInRole dgair = role.DesktopGroupAccessInRoleMgr.FindByDesktopGroup(UI_DesktopGroup_id);
                    if (dgair != null)
                    {
                        if (dgair.Access == AccessType.write)
                        {
                            return(AccessType.write);
                        }
                        else if (dgair.Access == AccessType.read)
                        {
                            accessType = AccessType.read;
                        }
                    }
                }
            }

            return(accessType);
        }