Michael Kublin has uploaded a new change for review.

Change subject: webadmin: Wrong error message is shown, when SuperUser 
permissions are removing from admin internal
......................................................................

webadmin: Wrong error message is shown, when SuperUser permissions are removing 
from admin internal

The following bug contains two errors:
1. Fixing error message: Cannot ${action} ${type}.
2. In canDoAction() , if we failed at first condition, no reason to perfrom 
additional checks

Change-Id: I825a379b383fd923046e17e6f1d27c6003c48900
Bug-Url: https://bugzilla.redhat.com/924880
Signed-off-by: Michael Kublin <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemovePermissionCommand.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
6 files changed, 15 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/13353/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemovePermissionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemovePermissionCommand.java
index 05aea92..5d87062 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemovePermissionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemovePermissionCommand.java
@@ -29,6 +29,12 @@
     }
 
     @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE);
+        addCanDoActionMessage(VdcBllMessages.VAR__TYPE__PERMISSION);
+    }
+
+    @Override
     protected boolean canDoAction() {
         boolean returnValue = true;
         permissions p = 
getPermissionDAO().get(getParameters().getPermission().getId());
@@ -36,13 +42,11 @@
                 (p.getrole_id().equals(PredefinedRoles.SUPER_USER.getId()))) {
             
addCanDoActionMessage(VdcBllMessages.USER_CANNOT_REMOVE_ADMIN_USER);
             returnValue = false;
-        }
-        if 
(MultiLevelAdministrationHandler.isLastSuperUserPermission(p.getrole_id())) {
+        } else if 
(MultiLevelAdministrationHandler.isLastSuperUserPermission(p.getrole_id())) {
             getReturnValue().getCanDoActionMessages()
                     
.add(VdcBllMessages.ERROR_CANNOT_REMOVE_LAST_SUPER_USER_ROLE.toString());
             returnValue = false;
-        }
-        if (returnValue && p.getRoleType().equals(RoleType.ADMIN) && 
!isSystemSuperUser()) {
+        } else if (p.getRoleType().equals(RoleType.ADMIN) && 
!isSystemSuperUser()) {
             
addCanDoActionMessage(VdcBllMessages.PERMISSION_REMOVE_FAILED_ONLY_SYSTEM_SUPER_USER_CAN_REMOVE_ADMIN_ROLES);
             returnValue = false;
         }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
index 087c9bb..6235e2d 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
@@ -23,6 +23,7 @@
     VAR__TYPE__VM_DISK,
     VAR__TYPE__BOOKMARK,
     VAR__TYPE__VM_TICKET,
+    VAR__TYPE__PERMISSION,
 
     // Gluster types
     VAR__TYPE__GLUSTER_VOLUME,
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 6cec53f..a66777b 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -226,6 +226,7 @@
 VAR__TYPE__STORAGE__POOL=$type Repository
 VAR__TYPE__USER_FROM_VM=$type User to VM
 VAR__TYPE__USER=$type User
+VAR__TYPE__PERMISSION=$type Permission
 VAR__ACTION__RUN=$action run
 VAR__ACTION__REMOVE=$action remove
 VAR__ACTION__ADD=$action add
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index 9ed7be4..aa1af45 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -610,6 +610,9 @@
     @DefaultStringValue("$type User")
     String VAR__TYPE__USER();
 
+    @DefaultStringValue("$type Permission")
+    String VAR__TYPE__PERMISSION();
+
     @DefaultStringValue("$action run")
     String VAR__ACTION__RUN();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index ff3737f..36f6f02 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -225,6 +225,7 @@
 VAR__TYPE__STORAGE__POOL=$type Repository
 VAR__TYPE__USER_FROM_VM=$type User to VM
 VAR__TYPE__USER=$type User
+VAR__TYPE__PERMISSION=$type Permission
 VAR__ACTION__RUN=$action run
 VAR__ACTION__REMOVE=$action remove
 VAR__ACTION__ADD=$action add
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 162f16c..ca5b983 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -223,6 +223,7 @@
 VAR__TYPE__STORAGE__POOL=$type Repository
 VAR__TYPE__USER_FROM_VM=$type User to VM
 VAR__TYPE__USER=$type User
+VAR__TYPE__PERMISSION=$type Permission
 VAR__ACTION__RUN=$action run
 VAR__ACTION__REMOVE=$action remove
 VAR__ACTION__ADD=$action add


--
To view, visit http://gerrit.ovirt.org/13353
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I825a379b383fd923046e17e6f1d27c6003c48900
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Michael Kublin <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to