Ejemplo n.º 1
0
        public void SearchRolesForUser_No_Service()
        {
            String strErrorResut = String.Empty;

            SearchRolesForUserService svc = new SearchRolesForUserService();
            SearchRolesForUserReq     req = new SearchRolesForUserReq();

            List <User> userList = Fwk.Security.FwkMembership.GetAllUsers(null);

            if (userList.Count > 0)
            {
                req.BusinessData.Username = userList[0].UserName;
            }
            else
            {
                Assert.Inconclusive("No se encontraron usuarios para testear SearchRolesForUserService");
            }

            try
            {
                SearchRolesForUserRes res = svc.Execute(req);
            }
            catch (Exception ex)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex);
            }


            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Obtiene los roles de un usuario
        /// </summary>
        /// <param name="pUserName">Nombre de usuario</param>
        /// <returns>Lista de roles</returns>
        public static RolList GetRolesForUser(string pUserName)
        {
            SearchRolesForUserReq req = new SearchRolesForUserReq();

            req.BusinessData.Username = pUserName;

            SearchRolesForUserRes res = req.ExecuteService <SearchRolesForUserReq, SearchRolesForUserRes>(WrapperSecurityProvider, req);

            if (res.Error != null)
            {
                throw Fwk.Exceptions.ExceptionHelper.ProcessException(res.Error);
            }

            return(res.BusinessData.RolList);
        }
Ejemplo n.º 3
0
        public void SearchRolesForUser_No_Service()
        {
            String strErrorResut = String.Empty;

            SearchRolesForUserService svc = new SearchRolesForUserService();
            SearchRolesForUserReq req = new SearchRolesForUserReq();

            List<User> userList = Fwk.Security.FwkMembership.GetAllUsers(null);
            if (userList.Count > 0)
            {
                req.BusinessData.Username = userList[0].UserName;
                
            }
            else
            {
                Assert.Inconclusive("No se encontraron usuarios para testear SearchRolesForUserService");
            }

            try
            {
                SearchRolesForUserRes res = svc.Execute(req);

            }
            catch (Exception ex)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex);
            }


            Assert.AreEqual<String>(strErrorResut, string.Empty, strErrorResut);

        }
Ejemplo n.º 4
0
        /// <summary>
        /// Obtiene los roles de un usuario
        /// </summary>
        /// <param name="pUserName">Nombre de usuario</param>
        /// <returns>Lista de roles</returns>
        public static RolList GetRolesForUser(string pUserName)
        {
            SearchRolesForUserReq req = new SearchRolesForUserReq();

            req.BusinessData.Username = pUserName;

            SearchRolesForUserRes res = req.ExecuteService<SearchRolesForUserReq, SearchRolesForUserRes>(WrapperSecurityProvider,req);

            if (res.Error != null)
                throw Fwk.Exceptions.ExceptionHelper.ProcessException(res.Error);

            return res.BusinessData.RolList;
        }