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:
@@ -79,28 +79,6 @@ public class SharedUser implements User {
|
||||
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
|
||||
public Map<String, String> getAttributes() {
|
||||
return Collections.<String, String>emptyMap();
|
||||
|
@@ -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.
|
||||
*/
|
||||
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
|
||||
@@ -80,23 +80,6 @@ public interface User extends Identifiable, Attributes, Permissions {
|
||||
*/
|
||||
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
|
||||
* was never active, the time that the user was last active is unknown, or
|
||||
|
@@ -26,26 +26,7 @@ import org.apache.guacamole.GuacamoleException;
|
||||
* any number of Guacamole users and other user groups, and defines the
|
||||
* permissions implicitly granted to its members.
|
||||
*/
|
||||
public interface UserGroup extends 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);
|
||||
public interface UserGroup extends Disableable, Identifiable, Attributes, Permissions {
|
||||
|
||||
/**
|
||||
* Returns a set of all readable user groups of which this user group is a
|
||||
|
@@ -65,28 +65,6 @@ public class SimpleUser extends AbstractUser {
|
||||
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
|
||||
* the given identifiers.
|
||||
|
@@ -44,26 +44,4 @@ public class SimpleUserGroup extends AbstractUserGroup {
|
||||
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