mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Created userIDorPath(infos) function
This commit is contained in:
		@@ -400,6 +400,11 @@ var ComunicWeb = {
 | 
			
		||||
			 */
 | 
			
		||||
			getIDfromPath: function(path, callback){},
 | 
			
		||||
 | 
			
		||||
			/**
 | 
			
		||||
			 * Get the ID or the path of a user, depending of what is available
 | 
			
		||||
			 */
 | 
			
		||||
			getIDorPath: function(userInfos){},
 | 
			
		||||
 | 
			
		||||
			/**
 | 
			
		||||
			 * Empty users cache
 | 
			
		||||
			 */
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,17 @@ function userID(){
 | 
			
		||||
    return ComunicWeb.user.userLogin.getUserID();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Return the ID of a user, or its path, depending of what 
 | 
			
		||||
 * is available
 | 
			
		||||
 * 
 | 
			
		||||
 * @param {Object} infos Informations about the user
 | 
			
		||||
 * @return {String} The ID of the user, or it's path
 | 
			
		||||
 */
 | 
			
		||||
function userIDorPath(infos){
 | 
			
		||||
    return ComunicWeb.user.userInfos.getIDorPath(infos);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get multiple users informations
 | 
			
		||||
 * 
 | 
			
		||||
 
 | 
			
		||||
@@ -247,6 +247,25 @@ ComunicWeb.user.userInfos = {
 | 
			
		||||
		ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, next);
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get the ID or the path of a user, depending of what is available
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {Object} userInfos Informations about the user
 | 
			
		||||
	 * @return {String} The ID of the user or its path, if he has one
 | 
			
		||||
	 */
 | 
			
		||||
	getIDorPath: function(userInfos){
 | 
			
		||||
 | 
			
		||||
		//Check if a virtual directory is available
 | 
			
		||||
		if(userInfos.virtualDirectory != null){
 | 
			
		||||
			return userInfos.virtualDirectory;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Else return user ID
 | 
			
		||||
		else {
 | 
			
		||||
			return userInfos.userID;
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Empty users cache
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user