mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +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
|
@Override
|
||||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
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
|
// Validate that we can update all applicable parents
|
||||||
if (!canUpdateModifiedParents(user, model.getIdentifier(), model))
|
if (!canUpdateModifiedParents(user, model.getIdentifier(), model))
|
||||||
|
@@ -250,6 +250,9 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
|||||||
* @param user
|
* @param user
|
||||||
* The user updating the existing object.
|
* The user updating the existing object.
|
||||||
*
|
*
|
||||||
|
* @param object
|
||||||
|
* The object being updated.
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* The model of the object being updated.
|
* The model of the object being updated.
|
||||||
*
|
*
|
||||||
@@ -258,7 +261,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
|||||||
* object.
|
* object.
|
||||||
*/
|
*/
|
||||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
||||||
ModelType model) throws GuacamoleException {
|
InternalType object, ModelType model) throws GuacamoleException {
|
||||||
|
|
||||||
// By default, do nothing.
|
// By default, do nothing.
|
||||||
if (!hasObjectPermission(user, model.getIdentifier(), ObjectPermission.Type.UPDATE))
|
if (!hasObjectPermission(user, model.getIdentifier(), ObjectPermission.Type.UPDATE))
|
||||||
@@ -470,7 +473,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
|||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
ModelType model = object.getModel();
|
ModelType model = object.getModel();
|
||||||
beforeUpdate(user, model);
|
beforeUpdate(user, object, model);
|
||||||
|
|
||||||
// Update object
|
// Update object
|
||||||
getObjectMapper().update(model);
|
getObjectMapper().update(model);
|
||||||
|
@@ -174,9 +174,10 @@ public class ConnectionService extends ModeledChildDirectoryObjectService<Modele
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
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
|
// Name must not be blank
|
||||||
if (model.getName() == null || model.getName().trim().isEmpty())
|
if (model.getName() == null || model.getName().trim().isEmpty())
|
||||||
|
@@ -157,9 +157,10 @@ public class ConnectionGroupService extends ModeledChildDirectoryObjectService<M
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
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
|
// Name must not be blank
|
||||||
if (model.getName() == null || model.getName().trim().isEmpty())
|
if (model.getName() == null || model.getName().trim().isEmpty())
|
||||||
|
@@ -157,9 +157,10 @@ public class SharingProfileService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
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
|
// Name must not be blank
|
||||||
if (model.getName() == null || model.getName().trim().isEmpty())
|
if (model.getName() == null || model.getName().trim().isEmpty())
|
||||||
|
@@ -203,9 +203,9 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeUpdate(ModeledAuthenticatedUser user,
|
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
|
// Username must not be blank
|
||||||
if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
|
if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
|
||||||
|
Reference in New Issue
Block a user