Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.User$Builder


        // require admin role
        if (!securityService.hasRole(Roles.ADMIN_ROLE)) {
            return error(ErrorMessages.APPLICATION_ACCESS_DENIED, Response.status(Response.Status.UNAUTHORIZED));
        }

        User currentUser = securityService.getCurrentUser();

        try {

            Role adminRole = securityService.findRole(Roles.ADMIN_ROLE);
            if (currentUser.getId().equals(userId) && adminRole.getId().equals(roleId)) {
                // you can't remove the admin role from yourself!
                return error("You can not remove the administrator role from your own user.", Response.status(Response.Status.BAD_REQUEST));
            }

            User user = userService.getUserById(userId, currentUser.getAccount());
            userService.removeRole(user, roleId);

        } catch (UserNotFoundException e) {
            return error("User not found.", Response.status(Response.Status.NOT_FOUND));
        }
View Full Code Here


    private Connection createValidSender() {
        Account account = new Account.Builder().name("ho").build();
        account.setId(new ObjectId());

        User user = new User.Builder().username("hey").account(account).build();
        user.setId(new ObjectId());

        Connection connection = new Connection.Builder()
                .provider(ConnectionProvidersForTests.RSS_PROVIDER)
                .url("http://foo.url1.com/rss")
                .credentials(new ConnectionCredentials("ident", "pass"))
View Full Code Here


    protected <T extends AbstractOwnableResponseSobaDTO> T toOwnerDTO(SobaObject sobaObject, T baseResponseDTO) {
        super.toBaseDTO(sobaObject, baseResponseDTO);

        User currentUser = securityService.getCurrentUser();
        baseResponseDTO.setOwner(sobaObject.getUser().getId().equals(currentUser.getId()));

        return baseResponseDTO;
    }
View Full Code Here

    @ManagedOperationParameters({
            @ManagedOperationParameter(name = "userObjectId", description = "The ID of the user to return."),
            @ManagedOperationParameter(name = "summary", description = "Returns summary results if true.")})
    public String getUser(String userObjectId, boolean summary)
            throws UserNotFoundException {
        User user = userService.getUserById(new ObjectId(userObjectId));
        return toJSON(user, summary);
    }
View Full Code Here

    private static User createTestUser() {
        Account account = new Account.Builder().name("tool").build();
        account.setId(new ObjectId());

        User user = new User.Builder()
                .username("maynard@toolband.com")
                .account(account)
                .password("trollolol")
                .fullname("Maynard James Keenan")
                .build();
        user.setId(new ObjectId());

        return user;
    }
View Full Code Here

        Account testAccount = new Account.Builder()
                .url("http://nodeable.com")
                .description("Nodeable Test Account")
                .name("Nodeable Testing")
                .build();
        User testUser = new User.Builder()
                .account(testAccount)
                .accountLocked(false)
                .accountOriginator(true)
                .fullname("Nodeable Test User")
                .username("test_user_" + new Date().getTime() + "@nodeable.com")
View Full Code Here

                .url("http://nodeable.com")
                .description("Nodeable Test Account")
                .name("Nodeable Testing")
                .build();

        User testUser = new User.Builder()
                .account(testAccount)
                .accountLocked(false)
                .accountOriginator(true)
                .fullname("Nodeable Test User")
                .username("test_user_" + new Date().getTime() + "@nodeable.com")
View Full Code Here

        Account testAccount = new Account.Builder()
                .url("http://nodeable.com")
                .description("Nodeable Test Account")
                .name("Nodeable Testing")
                .build();
        User testUser = new User.Builder()
                .account(testAccount)
                .accountLocked(false)
                .accountOriginator(true)
                .fullname("Nodeable Test User")
                .username("test_user_" + new Date().getTime() + "@nodeable.com")
View Full Code Here

    private Cache<String, User> superUserCache =
            CacheBuilder.newBuilder().maximumSize(1).expireAfterAccess(5, TimeUnit.MINUTES).build();

    @Override
    public boolean isUsernameAvailable(String name) {
        User u = userDAO.findUser(name);
        return u == null;
    }
View Full Code Here

        return roleDAO.findAccountRoles(accountId);
    }

    @Override
    public User getUserById(ObjectId userId) throws UserNotFoundException {
        User u = userDAO.get(userId);
        if (u == null) {
            throw new UserNotFoundException(userId.toString());
        }
        // Create the event stream entry
        eventService.createEvent(EventId.READ, u, null);
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.User$Builder

Copyright © 2018 www.massapicom. 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.