mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Add user role concept, stub permissions (#267).
This commit is contained in:
		
				
					committed by
					
						 Michael Jumper
						Michael Jumper
					
				
			
			
				
	
			
			
			
						parent
						
							9288c15104
						
					
				
				
					commit
					137e5cb91f
				
			| @@ -37,8 +37,6 @@ package net.sourceforge.guacamole.net.auth; | ||||
|  * | ||||
|  * ***** END LICENSE BLOCK ***** */ | ||||
|  | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Basic implementation of a Guacamole user which uses the username to | ||||
| @@ -60,26 +58,41 @@ public abstract class AbstractUser implements User, Comparable<AbstractUser> { | ||||
|      */ | ||||
|     private String password; | ||||
|  | ||||
|     /** | ||||
|      * This user's role. | ||||
|      */ | ||||
|     private Role role; | ||||
|      | ||||
|     @Override | ||||
|     public String getUsername() throws GuacamoleException { | ||||
|     public String getUsername() { | ||||
|         return username; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void setUsername(String username) throws GuacamoleException { | ||||
|     public void setUsername(String username) { | ||||
|         this.username = username; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String getPassword() throws GuacamoleException { | ||||
|     public String getPassword() { | ||||
|         return password; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void setPassword(String password) throws GuacamoleException { | ||||
|     public void setPassword(String password) { | ||||
|         this.password = password; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Role getRole() { | ||||
|         return role; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void setRole(Role role) { | ||||
|         this.role = role; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public int hashCode() { | ||||
|   | ||||
| @@ -0,0 +1,64 @@ | ||||
| package net.sourceforge.guacamole.net.auth; | ||||
|  | ||||
| /* ***** BEGIN LICENSE BLOCK ***** | ||||
|  * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||||
|  * | ||||
|  * The contents of this file are subject to the Mozilla Public License Version | ||||
|  * 1.1 (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.mozilla.org/MPL/ | ||||
|  * | ||||
|  * Software distributed under the License is distributed on an "AS IS" basis, | ||||
|  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||||
|  * for the specific language governing rights and limitations under the | ||||
|  * License. | ||||
|  * | ||||
|  * The Original Code is guacamole-ext. | ||||
|  * | ||||
|  * The Initial Developer of the Original Code is | ||||
|  * Michael Jumper. | ||||
|  * Portions created by the Initial Developer are Copyright (C) 2010 | ||||
|  * the Initial Developer. All Rights Reserved. | ||||
|  * | ||||
|  * Contributor(s): | ||||
|  * | ||||
|  * Alternatively, the contents of this file may be used under the terms of | ||||
|  * either the GNU General Public License Version 2 or later (the "GPL"), or | ||||
|  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||||
|  * in which case the provisions of the GPL or the LGPL are applicable instead | ||||
|  * of those above. If you wish to allow use of your version of this file only | ||||
|  * under the terms of either the GPL or the LGPL, and not to allow others to | ||||
|  * use your version of this file under the terms of the MPL, indicate your | ||||
|  * decision by deleting the provisions above and replace them with the notice | ||||
|  * and other provisions required by the GPL or the LGPL. If you do not delete | ||||
|  * the provisions above, a recipient may use your version of this file under | ||||
|  * the terms of any one of the MPL, the GPL or the LGPL. | ||||
|  * | ||||
|  * ***** END LICENSE BLOCK ***** */ | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * The role of a particular user, defining the access levels of that user. | ||||
|  *  | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public interface Role { | ||||
|     | ||||
|     /* FIXME: STUB */ | ||||
|      | ||||
|     /* | ||||
|      * POSSIBLE PERMISSIONS: | ||||
|      * | ||||
|      * UserManagementPermission(ADD/UPDATE/DELETE/VIEW, user or ANY) | ||||
|      * ConfigurationPermission(ADD/UPDATE/DELETE/VIEW, config or ANY) | ||||
|      * AdministrationPermission(ADD/REMOVE, permission or ANY) | ||||
|      * | ||||
|      * Each can be used with: | ||||
|      *  | ||||
|      * add(Permission) | ||||
|      * remove(Permission) | ||||
|      * has(Permission) | ||||
|      *  | ||||
|      */ | ||||
|      | ||||
| } | ||||
| @@ -37,8 +37,6 @@ package net.sourceforge.guacamole.net.auth; | ||||
|  * | ||||
|  * ***** END LICENSE BLOCK ***** */ | ||||
|  | ||||
| import net.sourceforge.guacamole.GuacamoleException; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * A user of the Guacamole web application. | ||||
| @@ -51,26 +49,23 @@ public interface User { | ||||
|      * Returns the name of this user, which must be unique across all users. | ||||
|      *  | ||||
|      * @return The name of this user. | ||||
|      * @throws GuacamoleException If an error occurs retrieving the username. | ||||
|      */ | ||||
|     public String getUsername() throws GuacamoleException; | ||||
|     public String getUsername(); | ||||
|  | ||||
|     /** | ||||
|      * Sets the name of this user, which must be unique across all users. | ||||
|      *  | ||||
|      * @param username  The name of this user. | ||||
|      * @throws GuacamoleException If an error occurs setting the username. | ||||
|      */ | ||||
|     public void setUsername(String username) throws GuacamoleException; | ||||
|     public void setUsername(String username); | ||||
|  | ||||
|     /** | ||||
|      * Returns this user's password. Note that the password returned may be | ||||
|      * hashed or completely arbitrary. | ||||
|      *  | ||||
|      * @return A String which may (or may not) be the user's password. | ||||
|      * @throws GuacamoleException If an error occurs retrieving the password. | ||||
|      */ | ||||
|     public String getPassword() throws GuacamoleException; | ||||
|     public String getPassword(); | ||||
|  | ||||
|     /** | ||||
|      * Sets this user's password. Note that while this function is guaranteed | ||||
| @@ -78,8 +73,22 @@ public interface User { | ||||
|      * getPassword() will return the value given to setPassword(). | ||||
|      *  | ||||
|      * @param password The password to set. | ||||
|      * @throws GuacamoleException If an error occurs setting the password. | ||||
|      */ | ||||
|     public void setPassword(String password) throws GuacamoleException; | ||||
|     public void setPassword(String password); | ||||
|  | ||||
|     /** | ||||
|      * Returns the role of this User. The role defines exactly which permissions | ||||
|      * a particular user has. | ||||
|      *  | ||||
|      * @return The role of this User. | ||||
|      */ | ||||
|     public Role getRole(); | ||||
|  | ||||
|     /** | ||||
|      * Sets the role of this User to the given Role. | ||||
|      *  | ||||
|      * @param role The role which this User should have. | ||||
|      */ | ||||
|     public void setRole(Role role); | ||||
|      | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user