Exemplo n.º 1
0
        public questStatus Read(UserId userId, out UserPrivilegeList userPrivilegeList)
        {
            // Initialize
            questStatus status = null;

            userPrivilegeList = null;


            // Get user
            User user = null;

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

            // Get user privileges
            using (FMSEntities dbContext = new FMSEntities())
            {
                List <Quest.Services.Dbio.FMS.UserPrivileges> _userPrivilegeList = null;
                status = read(dbContext, userId, out _userPrivilegeList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                userPrivilegeList      = new UserPrivilegeList();
                userPrivilegeList.User = user;
                foreach (Quest.Services.Dbio.FMS.UserPrivileges _userPrivilege in _userPrivilegeList)
                {
                    // Get privilege
                    PrivilegeId privilegeId = new PrivilegeId(_userPrivilege.PrivilegeId);
                    Privilege   privilege   = null;
                    status = _dbPrivilegesMgr.Read(privilegeId, out privilege);
                    if (!questStatusDef.IsSuccess(status))
                    {
                        return(status);
                    }
                    userPrivilegeList.PrivilegeList.Add(privilege);
                }
            }
            return(new questStatus(Severity.Success));
        }
Exemplo n.º 2
0
        public questStatus Read(GroupId groupId, out GroupPrivilegeList groupPrivilegeList)
        {
            // Initialize
            questStatus status = null;

            groupPrivilegeList = null;


            // Get group
            Group group = null;

            status = _dbGroupsMgr.Read(groupId, out group);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Get group privileges
            using (FMSEntities dbContext = new FMSEntities())
            {
                List <Quest.Services.Dbio.FMS.GroupPrivileges> _groupPrivilegeList = null;
                status = read(dbContext, groupId, out _groupPrivilegeList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                groupPrivilegeList       = new GroupPrivilegeList();
                groupPrivilegeList.Group = group;
                foreach (Quest.Services.Dbio.FMS.GroupPrivileges _groupPrivilege in _groupPrivilegeList)
                {
                    // Get privilege
                    PrivilegeId privilegeId = new PrivilegeId(_groupPrivilege.PrivilegeId);
                    Privilege   privilege   = null;
                    status = _dbPrivilegesMgr.Read(privilegeId, out privilege);
                    if (!questStatusDef.IsSuccess(status))
                    {
                        return(status);
                    }
                    groupPrivilegeList.PrivilegeList.Add(privilege);
                }
            }
            return(new questStatus(Severity.Success));
        }