Skip to content

Commit

Permalink
feat: #921 add first and last name to user verification identity card (
Browse files Browse the repository at this point in the history
  • Loading branch information
MCatherine1994 authored Jan 10, 2024
1 parent d12913f commit 4ab1af3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client-code-gen/app-access-control-openapi.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export interface IdimProxyIdirInfo {
* @type {string}
* @memberof IdimProxyIdirInfo
*/
'displayName'?: string | null;
'firstName'?: string | null;
/**
*
* @type {string}
* @memberof IdimProxyIdirInfo
*/
'lastName'?: string | null;
}

14 changes: 9 additions & 5 deletions frontend/src/components/grantaccess/UserIdentityCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ const props = defineProps<{
<p>Verified user information</p>
</template>
<template #content>
<div class="col-2 user-id">
<div class="col-2">
<label class="row">Username</label>
<span class="row">{{ props.userIdentity.userId }}</span>
</div>
<div class="col-6" v-if="props.userIdentity.found">
<label class="row">Display Name</label>
<span class="row">{{ props.userIdentity.displayName }}</span>
<div class="col-2" v-if="props.userIdentity.found">
<label class="row">First Name</label>
<span class="row">{{ props.userIdentity.firstName }}</span>
</div>
<div class="col-2" v-if="props.userIdentity.found">
<label class="row">Last Name</label>
<span class="row">{{ props.userIdentity.lastName }}</span>
</div>
<div
class="col d-flex align-items-center"
Expand All @@ -47,7 +51,7 @@ const props = defineProps<{
<style lang="scss" scoped>
@import '@/assets/styles/styles.scss';
.user-id {
.col-2 {
margin-left: 2rem;
margin-right: 2.5rem;
flex-grow: 0;
Expand Down
10 changes: 6 additions & 4 deletions server/backend/api/app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,16 @@ class IdimProxyIdirInfo(BaseModel):
# property returned from Idim-Proxy search of this form (not snake case)
found: bool
userId: Optional[Annotated[str, StringConstraints(max_length=20)]] = None
displayName: Optional[Annotated[str, StringConstraints(max_length=50)]] = None
firstName: Optional[Annotated[str, StringConstraints(max_length=20)]] = None
lastName: Optional[Annotated[str, StringConstraints(max_length=20)]] = None

@staticmethod
def from_api_json(json_dict):
info = IdimProxyIdirInfo(
found=json_dict["found"],
userId=json_dict["userId"],
displayName=json_dict["displayName"],
found=json_dict.get("found"),
userId=json_dict.get("userId"),
firstName=json_dict.get("firstName"),
lastName=json_dict.get("lastName"),
)
return info

Expand Down
3 changes: 2 additions & 1 deletion server/backend/testspg/crud/test_idim_proxy_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def test_valid_idir_search_pass(self):

assert search_result['found'] == True
assert search_result['userId'] == valid_idir_user
assert search_result['firstName'] is not None
assert search_result['lastName'] is not None

def test_idir_search_user_not_exist_no_user_found(self):
idim_proxy_api = IdimProxyService(copy.deepcopy(self.requester))
Expand All @@ -72,4 +74,3 @@ def test_idir_search_user_not_exist_no_user_found(self):
search_result = idim_proxy_api.search_idir(search_params)

assert search_result['found'] == False
assert search_result['userId'] == None
4 changes: 4 additions & 0 deletions server/backend/testspg/router/test_router_idim_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def test_search_idir_with_valid_user_found_result(
assert response.status_code == HTTPStatus.OK
assert response.json()['found'] == True
assert response.json()['userId'] == valid_user_id_param
assert response.json()['firstName'] is not None
assert response.json()['lastName'] is not None


def test_search_idir_with_invalid_user_return_not_found(
Expand All @@ -89,6 +91,8 @@ def test_search_idir_with_invalid_user_return_not_found(
assert response.status_code == HTTPStatus.OK
assert response.json()['found'] == False
assert response.json()['userId'] == invalid_user_id_param
assert response.json()['firstName'] == None
assert response.json()['lastName'] == None


def test_none_idir_user_cannot_search_idir_user(
Expand Down

0 comments on commit 4ab1af3

Please sign in to comment.