コード例 #1
0
        public CDesktopGroupAccessInUser FindByDesktopGroup(Guid UI_DesktopGroup_id)
        {
            List <CBaseObject> lstObj = GetList();

            foreach (CBaseObject obj in lstObj)
            {
                CDesktopGroupAccessInUser dgaiu = (CDesktopGroupAccessInUser)obj;
                if (dgaiu.UI_DesktopGroup_id == UI_DesktopGroup_id)
                {
                    return(dgaiu);
                }
            }
            return(null);
        }
コード例 #2
0
ファイル: CUser.cs プロジェクト: stonezhu870/RapidCore
        //获取用户桌面组权限
        //可写优先,只读次之,禁止最后
        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);
        }