mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-1479: Move disabled methods up to new Disableable interface.
This commit is contained in:
@@ -78,28 +78,6 @@ public class SharedUser implements User {
|
|||||||
public void setIdentifier(String identifier) {
|
public void setIdentifier(String identifier) {
|
||||||
throw new UnsupportedOperationException("Users authenticated via share keys are immutable.");
|
throw new UnsupportedOperationException("Users authenticated via share keys are immutable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>SharedUser accounts are always enabled, as access is controlled via
|
|
||||||
* the shared token.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isDisabled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>This method silently ignores the value passed in the disabled parameter,
|
|
||||||
* as disabling the account is done by invalidating the sharing token.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setDisabled(boolean disabled) {
|
|
||||||
// Silently ignore the parameter
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.guacamole.net.auth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface that defines items that can be enabled or disabled.
|
||||||
|
*/
|
||||||
|
public interface Disableable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this object is disabled, otherwise false.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* True if this object is disabled, otherwise false.
|
||||||
|
*/
|
||||||
|
default public boolean isDisabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the disabled status of this object to the boolean value provided,
|
||||||
|
* true if the object should be disabled, otherwise false.
|
||||||
|
*
|
||||||
|
* @param disabled
|
||||||
|
* True if the object should be disabled, otherwise false.
|
||||||
|
*/
|
||||||
|
default public void setDisabled(boolean disabled) {
|
||||||
|
// Default implementation takes no action.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -29,7 +29,7 @@ import org.apache.guacamole.GuacamoleUnsupportedException;
|
|||||||
/**
|
/**
|
||||||
* A user of the Guacamole web application.
|
* A user of the Guacamole web application.
|
||||||
*/
|
*/
|
||||||
public interface User extends Identifiable, Attributes, Permissions {
|
public interface User extends Disableable, Identifiable, Attributes, Permissions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All standard attribute names with semantics defined by the Guacamole web
|
* All standard attribute names with semantics defined by the Guacamole web
|
||||||
@@ -79,23 +79,6 @@ public interface User extends Identifiable, Attributes, Permissions {
|
|||||||
* @param password The password to set.
|
* @param password The password to set.
|
||||||
*/
|
*/
|
||||||
public void setPassword(String password);
|
public void setPassword(String password);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this user account is disabled, otherwise false.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* True if this user account is disabled, otherwise false.
|
|
||||||
*/
|
|
||||||
public boolean isDisabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the disabled status of this account to the boolean parameter as
|
|
||||||
* provided, true if the account should be disabled, otherwise false.
|
|
||||||
*
|
|
||||||
* @param disabled
|
|
||||||
* True if the account should be disabled, otherwise false.
|
|
||||||
*/
|
|
||||||
public void setDisabled(boolean disabled);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the date and time that this user was last active. If the user
|
* Returns the date and time that this user was last active. If the user
|
||||||
|
@@ -26,27 +26,8 @@ import org.apache.guacamole.GuacamoleException;
|
|||||||
* any number of Guacamole users and other user groups, and defines the
|
* any number of Guacamole users and other user groups, and defines the
|
||||||
* permissions implicitly granted to its members.
|
* permissions implicitly granted to its members.
|
||||||
*/
|
*/
|
||||||
public interface UserGroup extends Identifiable, Attributes, Permissions {
|
public interface UserGroup extends Disableable, Identifiable, Attributes, Permissions {
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the user group is disabled, making membership in the group
|
|
||||||
* ineffective, meaning that any permissions or other group membership
|
|
||||||
* assigned to this group will not apply to member groups and users.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* True if the group is disabled, otherwise false.
|
|
||||||
*/
|
|
||||||
public boolean isDisabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the disabled status of the user group, passing a boolean true value
|
|
||||||
* if the user group should be disabled, otherwise false.
|
|
||||||
*
|
|
||||||
* @param disabled
|
|
||||||
* True if the user group should be disabled, otherwise false.
|
|
||||||
*/
|
|
||||||
public void setDisabled(boolean disabled);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set of all readable user groups of which this user group is a
|
* Returns a set of all readable user groups of which this user group is a
|
||||||
* member. If permission is granted for the current user to modify the
|
* member. If permission is granted for the current user to modify the
|
||||||
|
@@ -64,28 +64,6 @@ public class SimpleUser extends AbstractUser {
|
|||||||
public SimpleUser(String username) {
|
public SimpleUser(String username) {
|
||||||
super.setIdentifier(username);
|
super.setIdentifier(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>This User implementation is always enabled, so this method will
|
|
||||||
* always return false.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isDisabled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>This User implementation is always enabled, so this method will
|
|
||||||
* silently ignore the value passed in under the disabled parameter.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setDisabled(boolean disabled) {
|
|
||||||
// Silently ignore disabled value
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new READ permission to the given set of permissions for each of
|
* Adds a new READ permission to the given set of permissions for each of
|
||||||
|
@@ -43,27 +43,5 @@ public class SimpleUserGroup extends AbstractUserGroup {
|
|||||||
public SimpleUserGroup(String identifier) {
|
public SimpleUserGroup(String identifier) {
|
||||||
super.setIdentifier(identifier);
|
super.setIdentifier(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>This implementation of UserGroup is always enabled, so this will
|
|
||||||
* always return false.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isDisabled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* <p>This implementation of UserGroup is always enabled, so this method
|
|
||||||
* will silently ignore the value passed in the disabled parameter.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setDisabled(boolean disabled) {
|
|
||||||
// Silently ignore as the UserGroup implementation is always enabled.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user