/*==================================================================================================================================
        * Private Methods
        *=================================================================================================================================*/
        private questStatus initialize()
        {
            // Initialize
            questStatus status = null;

            try
            {
                _dbUsersMgr    = new DbUsersMgr(this.UserSession);
                _dbAccountsMgr = new DbAccountsMgr(this.UserSession);
            }
            catch (System.Exception ex)
            {
                status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                       this.GetType().ToString(), MethodInfo.GetCurrentMethod().Name, ex.Message));
                throw new System.Exception(status.Message, ex);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #2
0
        public questStatus Read(UserSessionId userSessionId, out UserSession userSession)
        {
            // Initialize
            userSession = null;
            questStatus status = null;


            // Read userSession
            status = _dbUserSessionsMgr.Read(userSessionId, out userSession);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Get the user
            UserId   userId   = new UserId(userSession.UserId);
            User     user     = null;
            UsersMgr usersMgr = new UsersMgr(this.UserSession); // TODO: PLUG UP REAL USER SESSION

            status = usersMgr.Read(userId, out user);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            userSession.User = user;

            // Get user privileges.
            List <Privilege> privilegeList = null;
            DbAccountsMgr    dbAccountsMgr = new DbAccountsMgr(new UserSession()); // TODO: UNSTUB

            status = dbAccountsMgr.GetUserPrivileges(userId, out privilegeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            userSession.Privileges = privilegeList;

            return(new questStatus(Severity.Success));
        }