15088: Adds support for inactive account linking
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Tue, 7 May 2019 16:01:13 +0000 (12:01 -0400)
committerEric Biagiotti <ebiagiotti@veritasgenetics.com>
Tue, 7 May 2019 16:01:13 +0000 (12:01 -0400)
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

src/store/link-account-panel/link-account-panel-actions.ts
src/store/link-account-panel/link-account-panel-reducer.ts
src/views/link-account-panel/link-account-panel-root.tsx

index 5d853b5761ed4b05e80b4a8d09087044e46ca913..ee58e588f8f3b76df1a723d608cb58495e4f072c 100644 (file)
@@ -40,6 +40,9 @@ function validateLink(userToLink: UserResource, targetUser: UserResource) {
     else if (userToLink.isAdmin && !targetUser.isAdmin) {
         return LinkAccountPanelError.NON_ADMIN;
     }
+    else if (userToLink.isActive && !targetUser.isActive) {
+        return LinkAccountPanelError.INACTIVE;
+    }
     return LinkAccountPanelError.NONE;
 }
 
index 93987ff3eaac78b4157f9bb9249aae5f49f8123c..a8533185ba623d7270523e2b3fbdf8dcd6e90ae4 100644 (file)
@@ -14,6 +14,7 @@ export enum LinkAccountPanelStatus {
 
 export enum LinkAccountPanelError {
     NONE,
+    INACTIVE,
     NON_ADMIN,
     SAME_USER
 }
index a2cdee609621a1aba4928e68d3ba479e8e03c5cd..8661f6654a3be0b98f8d9623d4ff4cee0161493c 100644 (file)
@@ -97,6 +97,9 @@ export const LinkAccountPanelRoot = withStyles(styles) (
                 { error === LinkAccountPanelError.SAME_USER && <Grid item>
                     Cannot link {displayUser(targetUser)} to the same account.
                 </Grid> }
+                { error === LinkAccountPanelError.INACTIVE && <Grid item>
+                    Cannot link active account {displayUser(userToLink)} to inactive account {displayUser(targetUser)}.
+                </Grid> }
                 <Grid container item direction="row" spacing={24}>
                     <Grid item>
                         <Button variant="contained" onClick={() => cancelLinking()}>