mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-36: Provide access to modeled object within beforeUpdate().
This commit is contained in:
@@ -184,9 +184,9 @@ public abstract class ModeledChildDirectoryObjectService<InternalType extends Mo
|
||||
|
||||
@Override
|
||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||
ModelType model) throws GuacamoleException {
|
||||
InternalType object, ModelType model) throws GuacamoleException {
|
||||
|
||||
super.beforeUpdate(user, model);
|
||||
super.beforeUpdate(user, object, model);
|
||||
|
||||
// Validate that we can update all applicable parents
|
||||
if (!canUpdateModifiedParents(user, model.getIdentifier(), model))
|
||||
|
@@ -250,6 +250,9 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
||||
* @param user
|
||||
* The user updating the existing object.
|
||||
*
|
||||
* @param object
|
||||
* The object being updated.
|
||||
*
|
||||
* @param model
|
||||
* The model of the object being updated.
|
||||
*
|
||||
@@ -258,7 +261,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
||||
* object.
|
||||
*/
|
||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||
ModelType model) throws GuacamoleException {
|
||||
InternalType object, ModelType model) throws GuacamoleException {
|
||||
|
||||
// By default, do nothing.
|
||||
if (!hasObjectPermission(user, model.getIdentifier(), ObjectPermission.Type.UPDATE))
|
||||
@@ -470,7 +473,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
||||
throws GuacamoleException {
|
||||
|
||||
ModelType model = object.getModel();
|
||||
beforeUpdate(user, model);
|
||||
beforeUpdate(user, object, model);
|
||||
|
||||
// Update object
|
||||
getObjectMapper().update(model);
|
||||
|
@@ -174,9 +174,10 @@ public class ConnectionService extends ModeledChildDirectoryObjectService<Modele
|
||||
|
||||
@Override
|
||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||
ConnectionModel model) throws GuacamoleException {
|
||||
ModeledConnection object, ConnectionModel model)
|
||||
throws GuacamoleException {
|
||||
|
||||
super.beforeUpdate(user, model);
|
||||
super.beforeUpdate(user, object, model);
|
||||
|
||||
// Name must not be blank
|
||||
if (model.getName() == null || model.getName().trim().isEmpty())
|
||||
|
@@ -157,9 +157,10 @@ public class ConnectionGroupService extends ModeledChildDirectoryObjectService<M
|
||||
|
||||
@Override
|
||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||
ConnectionGroupModel model) throws GuacamoleException {
|
||||
ModeledConnectionGroup object, ConnectionGroupModel model)
|
||||
throws GuacamoleException {
|
||||
|
||||
super.beforeUpdate(user, model);
|
||||
super.beforeUpdate(user, object, model);
|
||||
|
||||
// Name must not be blank
|
||||
if (model.getName() == null || model.getName().trim().isEmpty())
|
||||
|
@@ -157,9 +157,10 @@ public class SharingProfileService
|
||||
|
||||
@Override
|
||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||
SharingProfileModel model) throws GuacamoleException {
|
||||
ModeledSharingProfile object, SharingProfileModel model)
|
||||
throws GuacamoleException {
|
||||
|
||||
super.beforeUpdate(user, model);
|
||||
super.beforeUpdate(user, object, model);
|
||||
|
||||
// Name must not be blank
|
||||
if (model.getName() == null || model.getName().trim().isEmpty())
|
||||
|
@@ -203,9 +203,9 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
||||
|
||||
@Override
|
||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||
UserModel model) throws GuacamoleException {
|
||||
ModeledUser object, UserModel model) throws GuacamoleException {
|
||||
|
||||
super.beforeUpdate(user, model);
|
||||
super.beforeUpdate(user, object, model);
|
||||
|
||||
// Username must not be blank
|
||||
if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
|
||||
|
Reference in New Issue
Block a user