blob: 4fd4bde9b2c7741fd29bcd1f3c381c5300a2a16e [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*/
package org.eclipse.osbp.ui.api.useraccess;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.osbp.dsl.common.datatypes.IDto;
import org.eclipse.osbp.ui.api.complexdatacontainer.IComplexDataContainer;
import org.eclipse.osbp.ui.api.user.filter.FilterMap;
import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action;
import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group;
/**
* The Interface IUserAccessService.
*/
public interface IUserAccessService extends IComplexDataContainer {
// in case we have no organizational information
public final String DEFAULTUSERROLE = "Users";
public final String DEFAULTADMINROLE = "Administrators";
/** The Constant NAME_ADMINISTRATOR. */
static final String NAME_ADMINISTRATOR="Administrator";
/** The Constant PASSWORD_ADMINISTRATOR. */
static final String PASSWORD_ADMINISTRATOR="Administrator";
/** The Constant POS_ADMINISTRATOR. */
static final String POS_ADMINISTRATOR="Administrator";
/**
* Gets the authorizations.
*
* @return the authorizations
*/
Object getAuthorizations();
/**
* Gets the user.
*
* @return the user
*/
IDto getUser();
/**
* Gets the user name.
*
* @return the user name
*/
String getUserName();
/**
* Gets the profileimage id.
*
* @return the profileimage id
*/
String getProfileimageId();
/**
* Gets the id.
*
* @return the id
*/
String getId();
/**
* Gets the position name.
*
* @return the position name
*/
String getPositionName();
/**
* Gets the email.
*
* @return the email
*/
String getEmail();
/**
* Gets the position.
*
* @return the position
*/
AbstractPosition getPosition();
/**
* Gets the perspective id.
*
* @return the perspective id
*/
String getPerspective();
/**
* Gets the extra password.
*
* @return the extra password
*/
String getExtraPassword();
/**
* Checks if the password is reset.
*
* @return true, if the password is reset.
*/
boolean isPasswordReset();
/**
* Gets the roles.
*
* @return the roles
*/
List<String> getRoles();
/**
* Gets the permissions.
*
* @return the permissions
*/
AbstractAuthorization getAuthorization();
/**
* Gets properties.
*
* @return the properties
*/
Map<String, Object> getProperties();
/**
* Checks if the given accessmode is granted.
*
* @param group the group
* @param action the action
* @param objectDescriptor the object descriptors
* @return true, if is granted
*/
boolean isGranted(Group group, Action action, String objectDescriptor);
/**
* Checks if property is vetoed, means if a property is invisible, etc.
*
* @param group the group
* @param action the action
* @param objectDescriptor the object descriptor
* @param propertyDescriptor the property descriptor
* @return true, if is vetoed
*/
boolean isVetoed(Group group, Action action, String objectDescriptor, String propertyDescriptor);
/**
* Checks if is authenticated.
*
* @return true, if is authenticated
*/
boolean isAuthenticated();
/**
* Authenticate.
*
* @param portal
* the portal
* @param username
* the username
* @param password
* the password
* @return true, if successful
*/
boolean authenticate(String portal, String username, String password);
/**
* Authenticate.
*
* @param portalId
* the portal id
* @param username
* the username
* @param password
* the password
* @return true, if successful
*/
boolean authenticate(int portalId, String username, String password);
/**
* Authenticate.
*
* @param username
* the username
* @param password
* the password
* @return true, if successful
*/
boolean authenticate(String username, String password);
/**
* Sets the session attribute.
*
* @param key
* the key
* @param value
* the value
*/
void setSessionAttribute(String key, Object value);
/**
* Gets the session attribute.
*
* @param key
* the key
* @return the session attribute
*/
Object getSessionAttribute(String key);
/**
* Logout.
*/
void logout();
/**
* Gets the all users.
*
* @return the all users
*/
Set<String> getAllUsers();
/**
* Gets the all users positions.
*
* @return the all users positions
*/
Map<String, String> getAllUsersPositions();
/**
* Gets the all emails.
*
* @return the all emails
*/
Set<String> getAllEmails();
/**
* Find users for position.
*
* @param orgNode
* the org node
* @return the sets the
*/
Set<String> findUsersForPosition(String orgNode);
/**
* Gets the all positions.
*
* @return the all positions
*/
Set<AbstractPosition> getAllPositions();
/**
* Find user account.
*
* @param username
* the username
* @return the user account dto
*/
IDto findUserAccount(String username);
/**
* Find position for user.
*
* @param username
* the username
* @return the a position
*/
AbstractPosition findPositionForUser(String username);
/**
* Find position for position name.
*
* @param positionName
* the position name
* @return the a position
*/
AbstractPosition findPositionForPositionName(String positionName);
/**
* Find roles for user.
*
* @param username
* the username
* @return the collection
*/
List<String> findRolesForUser(String username);
/**
* Find permissions for user.
*
* @param username
* the username
* @return the i permission list
*/
AbstractAuthorization findPermissionsForUser(String username);
/**
* Check user name uniqueness for logged in users.
*
* @param username
* the user name
* @return true, if successful
*/
boolean checkLoggedInUsernameExists(String username);
/**
* Check user name uniqueness independent of a successful log in.
*
* @param username
* the user name
* @return true, if successful
*/
boolean checkNotLoggedInUsernameExists(String username);
/**
* Check email uniqueness.
*
* @param email
* the email
* @return true, if successful
*/
boolean checkEmailExists(String email);
/**
* Lock account.
*
* @param username
* the username
* @param locked
* the locked
*/
void lockAccount(String username, boolean locked);
/**
* Enable account.
*
* @param username
* the username
* @param enabled
* the enabled
*/
void enableAccount(String username, boolean enabled);
/**
* Sets the cookie hash.
*
* @param username
* the username
* @param cookie
* the cookie
*/
void setCookieHash(String username, String cookie);
/**
* Checks if is cookie valid.
*
* @param username
* the username
* @param cookie
* the cookie
* @return true, if is cookie valid
*/
boolean isCookieValid(String username, String cookie);
/**
* Encrypt password.
*
* @param decryptedPassword
* the decrypted password
* @return the string
*/
String encryptPassword(String decryptedPassword);
/**
* Checks if is account locked.
*
* @param username
* the username
* @return true, if is account locked
*/
boolean isAccountLocked(String username);
/**
* Checks if the account is still not registered.
*
* @param username
* the username
* @return true, the account is still not registered
*/
boolean isAccountNotRegistered(String username);
/**
* Checks if is account enabled.
*
* @param username
* the username
* @return true, if is account enabled
*/
boolean isAccountEnabled(String username);
/**
* Encrypt passwords.
*/
void encryptPasswords();
/**
* Gets the all user account roles.
*
* @return the all user account roles
*/
Map<String, List<String>> getAllUserAccountRoles();
/**
* Gets the locale tag.
*
* @return the locale tag
*/
String getLocaleTag();
/**
* Gets the theme.
*
* @return the theme
*/
String getTheme();
/**
* Gets the prints the service.
*
* @return the prints the service
*/
String getPrintService();
/**
* Gets the user filter map.
*
* @return the user filter map
*/
FilterMap getFilterMap();
/**
* Checks if is superuser.
*
* @return true, if is superuser
*/
boolean isSuperuser();
/**
* Persist ui properties of the current user.
*
* @param properties the properties
*/
void persistProperties(Map<String, Object> properties);
/**
* Gets the blip process permissions for the authenticating organization from preferences.
*
* @return the blip process permissions
*/
IBlipProcessPermissions getBlipProcessPermissions();
}