Omer Frenkel has posted comments on this change.

Change subject: core: VirtIO console access key management
......................................................................


Patch Set 7:

(6 comments)

https://gerrit.ovirt.org/#/c/39512/7/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddUserProfileCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddUserProfileCommand.java:

Line 20:         boolean result = super.canDoAction();
Line 21: 
Line 22:         if (result && userProfileDao.getByUserId(getUserId()) != null) 
{
Line 23:             addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD);
Line 24:             addCanDoActionMessage(VdcBllMessages.VAR__TYPE__ROLE);
1. this shouldn't be TYPE__ROLE 
2. you should move both action and type msg variables to a specific method:
@Override
    protected void setActionMessageParameters() {
..
}
Line 25:             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED);
Line 26:             result = false;
Line 27:         }
Line 28: 


Line 21: 
Line 22:         if (result && userProfileDao.getByUserId(getUserId()) != null) 
{
Line 23:             addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD);
Line 24:             addCanDoActionMessage(VdcBllMessages.VAR__TYPE__ROLE);
Line 25:             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED);
not sure why you use "name already used", i think a better message would be 
~"profile already exists"
Line 26:             result = false;
Line 27:         }
Line 28: 
Line 29:         return result;


https://gerrit.ovirt.org/#/c/39512/7/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveUserProfileCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveUserProfileCommand.java:

Line 15:     }
Line 16: 
Line 17:     @Override
Line 18:     protected void executeCommand() {
Line 19:         
userProfileDao.remove(getParameters().getUserProfile().getId());
need to set succeeded to true
Line 20:     }


https://gerrit.ovirt.org/#/c/39512/7/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateUserProfileCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateUserProfileCommand.java:

Line 16:     }
Line 17: 
Line 18:     @Override
Line 19:     protected void executeCommand() {
Line 20:         UserProfile profile = userProfileDao.getByUserId(getUserId());
can do action need to check profile actually exist or this can be null
Line 21:         
profile.setSshPublicKey(getParameters().getUserProfile().getSshPublicKey());
Line 22:         userProfileDao.update(profile);
Line 23:         setSucceeded(true);
Line 24:     }


https://gerrit.ovirt.org/#/c/39512/7/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UserProfilesOperationCommandBase.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UserProfilesOperationCommandBase.java:

Line 43:         return result;
Line 44:     }
Line 45: 
Line 46:     @Override
Line 47:     public AuditLogType getAuditLogTypeValue() {
need to have specific messages for the different commands, also, now is see 
that the message is about setting ssh key rather add/update/remove user profile
Line 48:         return getSucceeded() ? AuditLogType.UNASSIGNED : 
AuditLogType.USER_FAILED_TO_SET_SSH_PUBLIC_KEY;
Line 49:     }
Line 50: 
Line 51:     @Override


https://gerrit.ovirt.org/#/c/39512/7/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UserProfileParameters.java
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/UserProfileParameters.java:

Line 9: 
Line 10:     private UserProfile profile;
Line 11: 
Line 12:     public UserProfileParameters() {
Line 13:         profile.setId(Guid.newGuid());
update wouldn't work if the id is always a new id
setting a new id is the job of add command
Line 14:     }
Line 15: 
Line 16:     public UserProfileParameters(Guid userId) {
Line 17:         profile.setId(Guid.newGuid());


-- 
To view, visit https://gerrit.ovirt.org/39512
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I5ff5403823e752e695ebde76a4b7fb83e07099b6
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Martin Betak <mbe...@redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to