Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rsid"></param>
        /// <param name="puid"></param>
        /// <returns></returns>
        public static PExpress ExpressOfUser(int rsid, int puid)
        {
            if (rsid < 1 || puid < 1)
            {
                return(PExpress.Null);
            }

            SQuery           SQ = BCF_PARAMS.NewSQ();
            ResourceExView   rv = new ResourceExView(true);
            Resource_LinkedM rl = new Resource_LinkedM();

            //------>>找出属于用户所在组(部门,角色)
            QView tempView = GroupService.G.GetInGroupsSQ(puid, false, true).SubSelect().As("A");

            //-------<<

            //------>>找出属于用户个人所有的RSID
            tempView = SQ.From(rl)
                       .Where(rl.RSID == rsid)
                       .BeginAnd()
                       .Begin(rl.LK_OBJT == User.LK_OBJT)
                       .And(rl.LK_OBJT_ID == puid)
                       .End()
                       .BeginOr(rl.LK_OBJT == Group.LK_OBJT)
                       .And(rl.LK_OBJT_ID.In(tempView))
                       .End()
                       .End()
                       .SubSelect(rl.RSID, rl.P_Express).As(rl.AsName);
            //------<<

            int pex = SQ.From(rv)
                      .Join(tempView, JoinType.Inner)
                      .On(rv.RSID == rl.RSID)
                      .Where(rv.Is_Disabled != 1).And(rv.PKG_Is_Disabled != true)
                      .SelectValue <int>(rl.P_Express.Max(), 0);

            //------<<


            //--------------------------------------------------------------------------

            switch (pex)
            {
            case 1:
                return(PExpress.ReadOnly);

            case 2:
                return(PExpress.Write);

            case 4:
                return(PExpress.Control);

            default:
                return(PExpress.Null);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 对密码进行加码
 /// </summary>
 /// <param name="userId">用户登录帐号</param>
 /// <param name="passWd">未加密的代码</param>
 /// <returns>加密后的代码</returns>
 public static string EncryptPassWd(string userId, string passWd)
 {
     return(BCF_PARAMS.ToHSA1(userId + "#" + passWd.Trim()));
 }