Examples of User


Examples of org.itcr.myguru.model.User

        // Gather information
        HttpSession session = request.getSession();
        String uri = request.getServletPath();
        String method = request.getMethod();
        User user = null;
        try {
            user = (User) session.getAttribute("user");
        } catch(Exception e) {}
        boolean auth = user != null;
       
        // Result
        Command command = null;
       
        // Web
        if(uri.equals("/")) {
            command = new HomeCommand();
        } else if(uri.equals("/debug")) {
            command = new DebugCommand();
        } else if(uri.equals("/dashboard")) {
            if(auth && user.isUser() && user.isEnabled()) {
                command = new DashboardCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        } else if(uri.equals("/profile")) {
            //if(auth && (user.isUser() || user.isAdmin())) {
            if(auth) {
                command = new ProfileCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        } else if(uri.equals("/admin")) {
            if(auth && user.isAdmin() && user.isEnabled()) {
                command = new AdminCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        // AJAX
        } else if(uri.equals("/login")) {
            command = new LoginCommand();
        } else if(uri.equals("/register")) {
            command = new RegisterCommand();
        } else if(uri.equals("/logout")) {
            command = new LogoutCommand();
        } else if(uri.equals("/request")) {
            if(auth && user.isUser() && user.isEnabled()) {
                command = new RequestCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        } else if(uri.equals("/answer")) {
            if(auth && user.isUser() && user.isEnabled()) {
                command = new AnswerCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        } else if(uri.equals("/upload/mygeo")) {
            if(auth && user.isAdmin() && user.isEnabled()) {
                command = new MyGeoCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        } else if(uri.equals("/expertise/add") ||
                uri.equals("/expertise/remove")) {
            if(auth && user.isUser() && user.isEnabled()) {
                command = new ExpertiseCommand();
            } else {
                command = new UnauthorizedCommand();
            }
        }
View Full Code Here

Examples of org.itnaf.model.User

        assertNotNull(bean.getUser());
        assertFalse(bean.hasErrors());
    }
   
    public void testRemove() throws Exception {
        User user2Delete = new User();
        user2Delete.setId(new Long(2));
        bean.setUser(user2Delete);
        assertEquals(bean.delete(), "list");
        assertFalse(bean.hasErrors());
    }
View Full Code Here

Examples of org.itschool_hillel.java.server.model.User

                ApplicationProperties.getProperty("database.password"));
    }

    @Override
    public User getByUsername(String username) {
        User user = null;

        String sql = "SELECT * FROM users WHERE username='" + username + "'";
        System.out.println(sql);

        try (Connection con = getConnection();
             Statement statement = con.createStatement();
             ResultSet result = statement.executeQuery(sql)) {

            if (result.next()) {
                String dbUsername = result.getString("username");
                String passwordDigest = result.getString("passwordDigest");
                String name = result.getString("name");

                user = new User(dbUsername, passwordDigest, name);
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.j2cms.model.user.User

public class ManageChannelFilter implements Filter {
  public void doFilter(ServletRequest req, ServletResponse res,
      FilterChain filterChain) throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) req;
    User user = WebUtil.getUser(request);
    if (user.getGroup()==null||user.getGroup().getManageChannel()!= true) {
      HttpServletResponse response = (HttpServletResponse) res;
      String ctp=request.getSession().getServletContext().getContextPath();
      response.sendRedirect(ctp+"/util/403");
      return;
    }
View Full Code Here

Examples of org.jSyncManager.SJS.Adapters.SMTPServer.Config.User

      // pass to Mbox
      String response = checkAddress(addr);
      if(response.equals("250 OK")){
         String[] address = addr.split("@");
         //Try and get the user from the local configuration: Make them otherwise
         User user = config.getUsers().get(address[0]);
     if(user==null){
        user = new User(address[0], null);
     }
     Domain dom = config.getDomains().get(address[1]);
     // may not be a local domain, create one if remote
     if(dom == null) {
       dom = new Domain(address[1]);
View Full Code Here

Examples of org.jamesdbloom.domain.User

    public void setupFixture() throws Exception {
        mockMvc = webAppContextSetup(webApplicationContext)
                .addFilters(springSecurityFilter)
                .alwaysDo(print()).build();

        user = new User(uuid, "user", "user@email.com", passwordEncoder.encode("password"));
        userDAO.save(user);
        csrfToken = (CsrfToken) mockMvc.perform(get("/").secure(true).session(session)).andReturn().getRequest().getAttribute("_csrf");
    }
View Full Code Here

Examples of org.java.demo.model.User

  @Property
  private List<String> roleValuesList;

  @SetupRender
  void setupRender() {
    user = new User();

    roleModelsList = new ArrayList<OptionModel>();

    allRoles = roleService.findAll();
    for (Role role : allRoles) {
View Full Code Here

Examples of org.javalite.activejdbc.test_models.User

public class Defect48Test extends ActiveJDBCTest{

    @Test
    public void shouldFailIfParentRequestedAndForeignKeyNotSet(){
        Address a = new Address();
        User u = a.parent(User.class);
        a(u).shouldBeNull();
    }
View Full Code Here

Examples of org.jayasoft.woj.common.model.User

      }
      return display();
    }
   
  public String displayAddUser() {
    User u = (User) getRequest().getAttribute("user"); //$NON-NLS-1$
    //Template info
    if(u==null || u.getId() ==0) {//Add
      getRequest().setAttribute("header.icon", "images/ee/user1_add.png"); //$NON-NLS-1$ //$NON-NLS-2$
      getRequest().setAttribute("header.title", Messages.get("adduser.title", getRequest().getLocale())); //$NON-NLS-1$ //$NON-NLS-2$
    } else {//edit
      getRequest().setAttribute("header.icon", "images/ee/user1_view.png"); //$NON-NLS-1$ //$NON-NLS-2$
      getRequest().setAttribute("header.title", Messages.get("edituser.title", getRequest().getLocale())); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

Examples of org.jbehave.example.spring.security.domain.User

  private OrganizationDao organizationDao;

  @Given("a user for $orgName with username $username and password $password")
  public void createUserWithUsernameAndPassword(String orgName, String username, String password) {
    Organization org = organizationDao.findByName(orgName);
    User user = new User();
    user.setOrganization(org);
    user.setUsername(username);
    user.setPasswordCleartext(password);
    userDao.persist(user);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.