/******************************************************************************
 * ExternalLogic.java - created by Sakai App Builder -AZ
 * 
 * Copyright (c) 2006 Sakai Project/Sakai Foundation
 * Licensed under the Educational Community License version 1.0
 * 
 * A copy of the Educational Community License has been included in this 
 * distribution and is available at: http://www.opensource.org/licenses/ecl1.php
 * 
 *****************************************************************************/

package org.sakaiproject.wontovlab.logic;


/**
 * This is the interface for logic which is external to our app logic
 * @author Sakai App Builder -AZ
 */
public interface ExternalLogic {

	public final static String NO_LOCATION = "noLocationAvailable";
	//public final static String SITE_TEMPLATE = "!site.template.course";
	
	//roles
	/*public final static String ROLE_STUDENT = "Student";
	public final static String ROLE_TEACHING_ASSISTANT = "Teaching Assistant";
	public final static String ROLE_INSTRUCTOR = "Instructor";*/
	

	// permissions
	public final static String Experiment_CREATE = "lar.Experiment.new";
	public final static String Experiment_EDIT = "lar.Experiment.edit";
	public final static String Experiment_DELETE = "lar.Experiment.del";
	public final static String Experiment_READ = "lar.Experiment.read";
	
	public final static String INFRAEX_CREATE = "lar.infraex.new";
	//public final static String INFRAEX_EDIT = "lar.infraex.edit";
	//public final static String INFRAEX_DELETE = "lar.infraex.del";
	public final static String INFRAEX_READ = "lar.infraex.read";
	
	public final static String AVAILABILITY_INTERVAL_CREATE = "lar.availability.interval.new";
	public final static String AVAILABILITY_INTERVAL_READ = "lar.availability.interval.read";

	/**
	 * @return the current sakai user id (not username)
	 */
	public String getCurrentUserId();

	/**
	 * Get the display name for a user by their unique id
	 * @param userId the current sakai user id (not username)
	 * @return display name (probably firstname lastname) or "----------" (10 hyphens) if none found
	 */
	public String getUserDisplayName(String userId);

	/**
	 * @return the current location id of the current user
	 */
	public String getCurrentLocationId();

	/**
	 * @param locationId a unique id which represents the current location of the user (entity reference)
	 * @return the title for the context or "--------" (8 hyphens) if none found
	 */
	public String getLocationTitle(String locationId);

	/**
	 * Check if this user has super admin access
	 * @param userId the internal user id (not username)
	 * @return true if the user has admin access, false otherwise
	 */
	public boolean isUserAdmin(String userId);

	/**
	 * Check if a user has a specified permission within a context, primarily
	 * a convenience method and passthrough
	 * 
	 * @param userId the internal user id (not username)
	 * @param permission a permission string constant
	 * @param locationId a unique id which represents the current location of the user (entity reference)
	 * @return true if allowed, false otherwise
	 */
	public boolean isUserAllowedInLocation(String userId, String permission, String locationId);
	
	public String getSakaiPropertyValue(String key);
	
	public String getSakaiHomePath();
	

}
