All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.gwt.client.security.ASecurityContext Maven / Gradle / Ivy

package com.jpattern.gwt.client.security;

import java.util.List;

import com.jpattern.gwt.client.AService;

/**
 * 
 * @author cinafr
 *
 */
public abstract class ASecurityContext extends AService {

	/**
	 * Return current user in session
	 * @return
	 */
	public abstract IUserSession getUserSession();
	
	/**
	 * Change the current user in session
	 * @param userSession
	 */
	public abstract void setUserSession(IUserSession userSession);
	
	/**
	 * Return true if the current user has the roleName role
	 * @param roleName
	 */
	public abstract boolean isUserInRole(String roleName);

	/**
	 * Return true if:
	 * - the current user has at least one the roles in the 'roles' list.
	 * - the 'roles' list is empty 
	 * @param roles
	 */
	public abstract boolean isUserInRole(String[] roles);
	
	/**
	 * Return true if:
	 * - the current user has at least one the roles in the 'roles' list.
	 * - the 'roles' list is empty 
	 * @param roles
	 */
	public abstract boolean isUserInRole(List roles);
	
	public abstract void addObserver(ISecurityContextObserver observer);
	
	public abstract void removeObserver(ISecurityContextObserver observer);

	/**
	 * Return true if the current userSession is valid
	 * @return
	 */
	public abstract boolean isUserValid();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy