com.formkiq.server.service.UserService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of formkiq-server Show documentation
Show all versions of formkiq-server Show documentation
Server-side integration for the FormKiQ ios application
/*
* Copyright (C) 2016 FormKiQ Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formkiq.server.service;
import java.util.Date;
import java.util.List;
import org.springframework.security.core.userdetails.UserDetails;
import com.formkiq.server.domain.User;
import com.formkiq.server.domain.type.FolderPermission;
import com.formkiq.server.domain.type.UserDTO;
import com.formkiq.server.domain.type.UserListDTO;
import com.formkiq.server.domain.type.UserRole;
import com.formkiq.server.domain.type.UserStatus;
/**
* User Services.
*
*/
public interface UserService {
/**
* Creates User.
* @param email {@link String}
* @param password {@link String}
* @param status {@link UserStatus}
* @param userRole {@link UserRole}
* @return {@link User}
* @throws PreconditionFailedException PreconditionFailedException
*/
User createUser(String email, String password,
UserStatus status, UserRole userRole)
throws PreconditionFailedException;
/**
* Delete User.
* @param email {@link String}
*/
void deleteUser(final String email);
/**
* Find Active User.
* @param email {@link String}
* @param password {@link String}
* @return {@link UserDetails}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
UserDetails findActiveUser(final String email,
final String password) throws AuthenticationFailureException;
/**
* Finds Active User by Email.
* @param email {@link String}
* @return {@link User}
*/
User findActiveUserByEmail(final String email);
/**
* Find user via email, regardless of UserStatus.
* @param email {@link String}
* @param includePassword boolean
* @return {@link UserDTO}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
UserDTO findUser(String email, boolean includePassword)
throws AuthenticationFailureException;
/**
* Finds User by Email.
* @param email {@link String}
* @return {@link UserDetails}
*/
UserDetails findUserByEmail(final String email);
/**
* Number of Users.
* @param token {@link String}
* @return List<UserDetails>
*/
UserListDTO findUsers(String token);
/**
* Generates a reset Token.
* @param email {@link String}
* @return {@link String}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
String generateResetToken(String email)
throws AuthenticationFailureException;
/**
* Generates Security Token.
* @return {@link String}
*/
String generateSecurityToken();
/**
* Invite User to Folder.
* @param user {@link UserDetails}
* @param email {@link String}
* @param folder {@link String}
* @param permissions {@link List}
* @return if new
*/
boolean inviteUserToFolder(UserDetails user, String email, String folder,
List permissions);
/**
* Saves User.
* @param email {@link String}
* @param password {@link String}
* @param role {@link UserRole}
* @param status {@link UserStatus}
* @return {@link User}
*/
User saveUser(String email, String password, UserRole role,
UserStatus status);
/**
* Update User's Last Login Date.
* @param email {@link String}
* @param now {@link Date}
*/
void updateLastLogin(String email, Date now);
/**
* Updates User's password.
* NOTE: password can also be a reset token.
* @param email {@link String}
* @param resettoken {@link String}
* @param newPassword {@link String}
*/
void updatePassword(String email, String resettoken, String newPassword);
}