-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(AUTH-CPC-755): Add More Roles Front End #573
feat(AUTH-CPC-755): Add More Roles Front End #573
Conversation
Qodana for JVM373 new problems were found
☁️ View the detailed Qodana report Contact Qodana teamContact us at [email protected]
|
@@ -12,7 +12,7 @@ const petClinicApp = angular.module('petClinicApp', [ | |||
'ui.router', 'layoutNav', 'layoutFooter', 'layoutWelcome', 'ownerList', 'ownerDetails', 'ownerForm', 'ownerRegister', 'petRegister', 'petForm' | |||
, 'visits', 'vetList','vetForm','vetDetails', 'visitList', 'billForm', 'billUpdateForm', 'loginForm', 'rolesDetails', 'signupForm', 'productDetailsInfo', | |||
'billDetails', 'billsByOwnerId', 'billHistory','billsByVetId','inventoryList', 'inventoryForm', 'productForm','inventoryProductList', 'inventoryUpdateForm', 'productUpdateForm', | |||
'verification' , 'adminPanel','resetPwdForm','forgotPwdForm','petTypeList', 'petDetails','userDetails']); | |||
'verification' , 'adminPanel','resetPwdForm','forgotPwdForm','petTypeList', 'userModule', 'petDetails','userDetails']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is user module ? This PR is about roles.
<td> | ||
<!-- Using a nested ng-repeat to loop over each role in the user.roles array --> | ||
<span ng-repeat="role in user.roles"> | ||
{{ role.name }}<span ng-if="!$last">, </span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing ? Is it reading from the fetched user ?
templateUrl: 'scripts/auth/update-role-form/role-update.template.html', | ||
controller: 'UpdateUserRoleController', | ||
bindings: { | ||
userId: '<' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing ?
|
||
angular.module('userModule').service('UserService', [function() { | ||
this.getAvailableRoles = function() { | ||
return ['ADMIN', 'VET', 'OWNER']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these values not fetched from the database, what happens if a new role is added ? For example I added the inventory manager ?
<input type="checkbox" class="form-check-input" id="{{role}}" ng-model="selectedRoles[role]" ng-true-value="'{{role}}'" ng-false-value="undefined"> | ||
<label class="form-check-label" for="{{role}}">{{role}}</label> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using checkboxes ? Radio buttons would fit better since we would want to choose only one role.
if (rolesList.length > 1) { | ||
alert('Please select only one role.'); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use radio buttons instead of this bloated logic ?
5758a2f
to
a82df7e
Compare
a82df7e
to
889f5cc
Compare
'use strict'; | ||
|
||
angular.module('userModule').service('UserService', [function() { | ||
this.getAvailableRoles = function() { | ||
return ['ADMIN', 'VET', 'OWNER']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this normally work with the default preexisting roles? New ones would prove to be an issue no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good just some minor questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dylan recently added his inventory manger story so I would recommend adding Inventory Manager as a role if you have the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is acceptable but definitely could be better.
JIRA: link to jira ticket
https://champlainsaintlambert.atlassian.net/browse/CPC-755
Context:
What is the ticket about and why are we doing this change.
This ticket is about adding three roles, and one of them to be assigned to users because we want them to have a restricted access in the system. It is also about the feature for the admin to update the users' role if ever a user needs a different permission on the website.
Changes
What are the various changes and what other modules do those changes effect.
This can be bullet point or sentence format.
Before and After UI (Required for UI-impacting PRs)
If this is a change to the UI, include before and after screenshots to show the differences.
If this is a new UI feature, include screenshots to show reviewers what it looks like.
New "Update Role" Button and New "Role" Column in Admin Panel
New Update User Role Form (After Clicking Update Role Button)
Dev notes (Optional)
Linked pull requests (Optional)