[arvados-workbench2] created: 2.6.3-35-gce4b1330

git repository hosting git at public.arvados.org
Fri Jul 21 17:12:29 UTC 2023


        at  ce4b1330e232f9f29b6f0bf361f3fd6913d9ae6e (commit)


commit ce4b1330e232f9f29b6f0bf361f3fd6913d9ae6e
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Jul 21 13:07:14 2023 -0400

    18946: Transitional user profile feature
    
    If UserProfileFormFields is non-empty, and the user's prefs.profile is
    empty, wb2 will navigate to the user account page to encourage people
    to fill out the profile.  Unlike wb1, filling it out is not mandatory.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/common/config.ts b/src/common/config.ts
index fd8b75ce..c1d56548 100644
--- a/src/common/config.ts
+++ b/src/common/config.ts
@@ -76,6 +76,7 @@ export interface ClusterConfigJSON {
         SiteName: string;
         IdleTimeout: string;
         BannerUUID: string;
+        UserProfileFormFields: {};
     };
     Login: {
         LoginCluster: string;
@@ -305,7 +306,8 @@ export const mockClusterConfigJSON = (
         SSHHelpHostSuffix: '',
         SiteName: '',
         IdleTimeout: '0s',
-        BannerUUID: ""
+        BannerUUID: "",
+        UserProfileFormFields: {}
     },
     Login: {
         LoginCluster: '',
diff --git a/src/services/common-service/common-resource-service.ts b/src/services/common-service/common-resource-service.ts
index 624525e6..907f0081 100644
--- a/src/services/common-service/common-resource-service.ts
+++ b/src/services/common-service/common-resource-service.ts
@@ -24,14 +24,20 @@ export class CommonResourceService<T extends Resource> extends CommonService<T>
         super(serverApi, resourceType, actions, readOnlyFields.concat([
             'uuid',
             'etag',
-            'kind'
+            'kind',
+            'canWrite',
+            'canManage',
+            'createdAt',
+            'modifiedAt',
+            'modifiedByClientUuid',
+            'modifiedByUserUuid'
         ]));
     }
 
     create(data?: Partial<T>, showErrors?: boolean) {
         let payload: any;
         if (data !== undefined) {
-            this.readOnlyFields.forEach( field => delete data[field] );
+            this.readOnlyFields.forEach(field => delete data[field]);
             payload = {
                 [this.resourceType.slice(0, -1)]: CommonService.mapKeys(snakeCase)(data),
             };
@@ -42,7 +48,7 @@ export class CommonResourceService<T extends Resource> extends CommonService<T>
     update(uuid: string, data: Partial<T>, showErrors?: boolean, select?: string[]) {
         let payload: any;
         if (data !== undefined) {
-            this.readOnlyFields.forEach( field => delete data[field] );
+            this.readOnlyFields.forEach(field => delete data[field]);
             payload = {
                 [this.resourceType.slice(0, -1)]: CommonService.mapKeys(snakeCase)(data),
             };
diff --git a/src/store/auth/auth-middleware.ts b/src/store/auth/auth-middleware.ts
index 0d08405a..16584313 100644
--- a/src/store/auth/auth-middleware.ts
+++ b/src/store/auth/auth-middleware.ts
@@ -10,6 +10,7 @@ import { User } from "models/user";
 import { RootState } from 'store/store';
 import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
 import { WORKBENCH_LOADING_SCREEN } from 'store/workbench/workbench-actions';
+import { navigateToMyAccount } from 'store/navigation/navigation-action';
 
 export const authMiddleware = (services: ServiceRepository): Middleware => store => next => action => {
     // Middleware to update external state (local storage, window
@@ -35,6 +36,15 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
             }
 
             store.dispatch<any>(initSessions(services.authService, state.auth.remoteHostsConfig[state.auth.localCluster], user));
+            if (Object.keys(state.auth.config.clusterConfig.Workbench.UserProfileFormFields).length > 0 &&
+                user.isActive &&
+                (Object.keys(user.prefs).length === 0 ||
+                    user.prefs.profile === undefined ||
+                    Object.keys(user.prefs.profile!).length === 0)) {
+                // If the user doesn't have a profile set, send them
+                // to the user profile page to encourage them to fill it out.
+                store.dispatch(navigateToMyAccount);
+            }
             if (!user.isActive) {
                 // As a special case, if the user is inactive, they
                 // may be able to self-activate using the "activate"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list