Update the behavior of roles for OVP/ONAP portals 42/67542/2
authorPanagiotis Karalis <pkaralis@intracom-telecom.com>
Thu, 11 Apr 2019 14:33:09 +0000 (17:33 +0300)
committerPanagiotis Karalis <pkaralis@intracom-telecom.com>
Mon, 15 Apr 2019 09:53:27 +0000 (12:53 +0300)
The behavior of portals' roles are updated according to CVC decisions.
The behavior will be:
* no roles - the person can upload results and share results
to other users, but can not submit an application/results for review
* "user" role - the person can submit the application/results
fore review. To have this role, the person MUST have signed the
participation agreement through docusign.
* "reviewer" role - the person can see applications / results
submitted to review, and can vote (+1 / -1) on those results as part
of the review process. Votes are recorded.
* "admin" role - the person can approve applications
for public listing, etc. Final gatekeeper for the website, etc.
Responsible to ensure processes are followed, etc.

Change-Id: Ieca55725378c85f544eeea4390046bae456ee1a3
Signed-off-by: Panagiotis Karalis <pkaralis@intracom-telecom.com>
3rd_party/static/onap-ui/components/results/results.html
3rd_party/static/onap-ui/components/results/resultsController.js
3rd_party/static/onap-ui/shared/header/header.html
3rd_party/static/testapi-ui/components/results/results.html
3rd_party/static/testapi-ui/components/results/resultsController.js
3rd_party/static/testapi-ui/shared/header/header.html
opnfv_testapi/ui/auth/constants.py

index ab2e999..2206029 100644 (file)
@@ -1,8 +1,7 @@
 <div class="container-fluid common-main-container">
   <h3>{{ctrl.pageHeader}}</h3>
   <p>{{ctrl.pageParagraph}}</p>
-  <form class="form-inline" ng-show="ctrl.isUserResults"
-        ng-if="auth.isAuthenticated && auth.currentUser.role.indexOf('user') != -1">
+  <form class="form-inline" ng-show="ctrl.isUserResults">
     <h4>Upload Results
       <i class="glyphicon glyphicon-question-sign opnfv-blue"
          uib-tooltip="results file is logs.xxx.tar.gz under your dovetail installation path"></i>
@@ -82,7 +81,8 @@
                   <a ng-class="{'hide': result.status != 'review'}"
                      ng-click="ctrl.deleteApplication(result)">withdraw submit</a>
                 </li>
-                <li role="menuitem" ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults"
+                <li role="menuitem"
+                    ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults && auth.currentUser.role.indexOf('user') != -1"
                     class="menu-item menu-item-type-post_type menu-item-object-page">
                   <a ng-class="{'hide': result.status != 'private'}"
                      ng-click="ctrl.openApplicationModal(result)">submit to review</a>
index d459495..5983dd8 100644 (file)
                             "primary_business_email": ctrl.primary_business_email
                         };
 
-                        $http.post(testapiApiUrl + "/onap/cvp/applications", data).then(function(resp) {
-                            if (resp.data.code && resp.data.code != 0) {
-                                alert(resp.data.msg);
-                                return;
+                        if (ctrl.company_name == null ||
+                        ctrl.company_website == null ||
+                        ctrl.primary_contact_name == null ||
+                        ctrl.primary_phone_number == null ||
+                        ctrl.primary_business_email== null ||
+                        ctrl.xnf_version == null ||
+                        ctrl.xnf_name == null ||
+                        ctrl.xnf_description == null ||
+                        ctrl.xnfd_id == null) {
+
+                            alert('There are empty required fields in the application form');
+
+                        } else if (ctrl.lab_location == 'third') {
+                            if (ctrl.lab_name == null ||
+                            ctrl.lab_email == null ||
+                            ctrl.lab_address == null ||
+                            ctrl.lab_phone == null) {
+
+                            alert('There are empty required fields in the application form');
+
+                            } else {
+                                $http.post(testapiApiUrl + "/onap/cvp/applications", data).then(function(resp) {
+                                    if (resp.data.code && resp.data.code != 0) {
+                                        alert(resp.data.msg);
+                                        return;
+                                    }
+                                    toggleCheck(result, 'status', 'review');
+                                }, function(error) {
+                                    /* do nothing */
+                                });
                             }
-                            toggleCheck(result, 'status', 'review');
-                        }, function(error) {
-                            /* do nothing */
-                        });
+                        } else {
+                            $http.post(testapiApiUrl + "/onap/cvp/applications", data).then(function(resp) {
+                                if (resp.data.code && resp.data.code != 0) {
+                                    alert(resp.data.msg);
+                                    return;
+                                }
+                                toggleCheck(result, 'status', 'review');
+                            }, function(error) {
+                                /* do nothing */
+                            });
+                        }
                     }
                 }, function(error) {
                     /* do nothing */
                 });
                 logo_name = file.name;
             }
+
+            if (typeof file === 'undefined') {
+                alert('There are empty required fields in the application form');
+            }
             ngDialog.close();
         }
 
index 8e18026..732bb9e 100644 (file)
@@ -23,8 +23,7 @@
             ng-if="auth.isAuthenticated && auth.canReview(auth.currentUser)">
           <a ui-sref="communityResults">Incoming Reviews</a>
         </li>
-        <li ng-class="{ active: header.isActive('/user_results')}"
-            ng-if="auth.isAuthenticated && auth.currentUser.role.indexOf('user') != -1">
+        <li ng-class="{ active: header.isActive('/user_results')}" ng-if="auth.isAuthenticated">
           <a ui-sref="userResults">My Results</a>
         </li>
         <li ng-class="{ active: header.isActive('/profile')}" ng-if="auth.isAuthenticated">
index 30bcd94..b55be34 100644 (file)
@@ -1,8 +1,7 @@
 <div class="container-fluid common-main-container">
   <h3>{{ctrl.pageHeader}}</h3>
   <p>{{ctrl.pageParagraph}}</p>
-  <form class="form-inline" ng-show="ctrl.isUserResults"
-        ng-if="auth.isAuthenticated && auth.currentUser.role.indexOf('user') != -1">
+  <form class="form-inline" ng-show="ctrl.isUserResults">
     <h4>Upload Results
       <i class="glyphicon glyphicon-question-sign opnfv-blue"
          uib-tooltip="results file is logs.xxx.tar.gz under your dovetail installation path"></i>
@@ -82,7 +81,8 @@
                   <a ng-class="{'hide': result.status != 'review'}"
                      ng-click="ctrl.deleteApplication(result)">withdraw submit</a>
                 </li>
-                <li role="menuitem" ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults"
+                <li role="menuitem"
+                    ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults && auth.currentUser.role.indexOf('user') != -1"
                     class="menu-item menu-item-type-post_type menu-item-object-page">
                   <a ng-class="{'hide': result.status != 'private'}"
                      ng-click="ctrl.openApplicationModal(result)">submit to review</a>
index 1fb4f0d..f752412 100644 (file)
                             "lab_phone": ctrl.lab_phone
                         };
 
-                        $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) {
-                            if (resp.data.code && resp.data.code != 0) {
-                                alert(resp.data.msg);
-                                return;
+                        if(ctrl.organization_name == null ||
+                        ctrl.organization_web == null ||
+                        ctrl.product_name == null ||
+                        ctrl.product_spec == null ||
+                        ctrl.product_documentation == null ||
+                        ctrl.prim_name == null ||
+                        ctrl.prim_email == null ||
+                        ctrl.prim_address == null ||
+                        ctrl.prim_phone == null ||
+                        ctrl.description == null ||
+                        ctrl.sut_version == null ||
+                        ctrl.sut_label == null ||
+                        ctrl.sut_hw_version == null ||
+                        ctrl.ovp_category == null) {
+
+                            alert('There are empty required fields in the application form');
+
+                        } else if (ctrl.lab_location == 'third') {
+                            if (ctrl.lab_name == null ||
+                            ctrl.lab_email == null ||
+                            ctrl.lab_address == null ||
+                            ctrl.lab_phone == null) {
+                                 alert('There are empty required fields in the application form');
+                            } else {
+
+                            $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) {
+                                if (resp.data.code && resp.data.code != 0) {
+                                    alert(resp.data.msg);
+                                    return;
+                                }
+                                toggleCheck(result, 'status', 'review');
+                            }, function(error) {
+                                /* do nothing */
+                            });
+
                             }
-                            toggleCheck(result, 'status', 'review');
-                        }, function(error) {
-                            /* do nothing */
-                        });
+
+                        } else {
+
+                            $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) {
+                                if (resp.data.code && resp.data.code != 0) {
+                                    alert(resp.data.msg);
+                                    return;
+                                }
+                                toggleCheck(result, 'status', 'review');
+                            }, function(error) {
+                                /* do nothing */
+                            });
+
+                        }
                     }
                 }, function(error) {
                     /* do nothing */
                 });
                 logo_name = file.name;
             }
+
+            if (typeof file === 'undefined') {
+                alert('There are empty required fields in the application form');
+            }
             ngDialog.close();
         }
 
index fad240c..1917a83 100644 (file)
@@ -23,8 +23,7 @@
             ng-if="auth.isAuthenticated && auth.canReview(auth.currentUser)">
           <a ui-sref="communityResults">Incoming Reviews</a>
         </li>
-        <li ng-class="{ active: header.isActive('/user_results')}"
-            ng-if="auth.isAuthenticated && auth.currentUser.role.indexOf('user') != -1">
+        <li ng-class="{ active: header.isActive('/user_results')}" ng-if="auth.isAuthenticated">
           <a ui-sref="userResults">My Results</a>
         </li>
         <li ng-class="{ active: header.isActive('/profile')}" ng-if="auth.isAuthenticated">
index 44ccb46..3cdfe09 100644 (file)
@@ -1,6 +1,6 @@
 OPENID = 'openid'
 ROLE = 'role'
-DEFAULT_ROLE = 'user'
+DEFAULT_ROLE = ''
 
 # OpenID parameters
 OPENID_MODE = 'openid.mode'