From 019b0c3c942b3bb98eef52a16dc847d328ceb08a Mon Sep 17 00:00:00 2001 From: cptran777 Date: Tue, 11 Sep 2018 16:51:52 -0700 Subject: [PATCH 1/4] Add jitacl contact to configs update getconfigs to take default value --- wherehows-frontend/app/controllers/Application.java | 4 ++++ .../datasets/containers/dataset-acl-access.ts | 9 ++++++++- wherehows-web/app/controllers/datasets/dataset.ts | 7 +++++++ wherehows-web/app/routes/datasets/dataset.ts | 1 + wherehows-web/app/services/configurator.ts | 10 ++++++++-- .../app/templates/components/dataset-aclaccess.hbs | 2 +- .../datasets/containers/dataset-acl-access.hbs | 1 + wherehows-web/app/templates/datasets/dataset.hbs | 1 + .../app/typings/api/configurator/configurator.d.ts | 1 + 9 files changed, 32 insertions(+), 4 deletions(-) diff --git a/wherehows-frontend/app/controllers/Application.java b/wherehows-frontend/app/controllers/Application.java index c7f55fd652..b9c8eb2982 100644 --- a/wherehows-frontend/app/controllers/Application.java +++ b/wherehows-frontend/app/controllers/Application.java @@ -92,6 +92,9 @@ public class Application extends Controller { private static final String WHZ_WIKI_LINKS__EXPORT_POLICY = Play.application().configuration().getString("links.wiki.exportPolicy", ""); + private static final String WHZ_LINKS__JIT_ACL_CONTACT = + Play.application().configuration().getString("links.jitAcl.contact") + private static final String DB_WHEREHOWS_URL = Play.application().configuration().getString("database.opensource.url"); private static final String WHZ_DB_DSCLASSNAME = @@ -209,6 +212,7 @@ public class Application extends Controller { config.put("suggestionConfidenceThreshold", Integer.parseInt(WHZ_SUGGESTION_CONFIDENCE_THRESHOLD)); config.set("wikiLinks", wikiLinks()); config.set("JitAclAccessWhitelist", Json.toJson(StringUtils.split(JIT_ACL_WHITELIST, ','))); + config.set("jitAclContact", WHZ_LINKS__JIT_ACL_CONTACT); config.set("tracking", trackingInfo()); // In a staging environment, we can trigger this flag to be true so that the UI can handle based on // such config and alert users that their changes will not affect production data diff --git a/wherehows-web/app/components/datasets/containers/dataset-acl-access.ts b/wherehows-web/app/components/datasets/containers/dataset-acl-access.ts index 145a72be25..644f6c3892 100644 --- a/wherehows-web/app/components/datasets/containers/dataset-acl-access.ts +++ b/wherehows-web/app/components/datasets/containers/dataset-acl-access.ts @@ -76,6 +76,11 @@ export default class DatasetAclAccessContainer extends Component { */ isJitAclAccessEnabled: boolean; + /** + * Who to contact in case of error + */ + jitAclContact: string; + /** * Request object for the current user requesting access control * @type {IRequestAccessControlEntry} @@ -170,7 +175,9 @@ export default class DatasetAclAccessContainer extends Component { notify(NotificationEvent.confirm, { header: 'Successfully processed ACL request', - content: `${message} Your access should be enabled within 15 minutes. Contact ask_acl@linkedin.com if you're still having issues after that time.`, + content: `${message} Your access should be enabled within 15 minutes. Contact ${ + this.jitAclContact + } if you're still having issues after that time.`, dialogActions, confirmButtonText: false, dismissButtonText: 'Dismiss' diff --git a/wherehows-web/app/controllers/datasets/dataset.ts b/wherehows-web/app/controllers/datasets/dataset.ts index 7422355cc4..4ab9185e44 100644 --- a/wherehows-web/app/controllers/datasets/dataset.ts +++ b/wherehows-web/app/controllers/datasets/dataset.ts @@ -60,6 +60,13 @@ export default class DatasetController extends Controller { */ jitAclAccessWhitelist: Array; + /** + * String to indicate who to contact for acl issues + * @type {string} + * @memberof DatasetController + */ + jitAclContact: string; + /** * References the collection of help links with references to external pages of help information * @type {Record} diff --git a/wherehows-web/app/routes/datasets/dataset.ts b/wherehows-web/app/routes/datasets/dataset.ts index 9afc961047..840baaedb1 100644 --- a/wherehows-web/app/routes/datasets/dataset.ts +++ b/wherehows-web/app/routes/datasets/dataset.ts @@ -95,6 +95,7 @@ export default class DatasetRoute extends Route { setProperties(controller, { isInternal: !!getConfig('isInternal'), jitAclAccessWhitelist: getConfig('JitAclAccessWhitelist') || [], + jitAclContact: getConfig('jitAclContact', 'your ACL admin'), shouldShowDatasetLineage: getConfig('shouldShowDatasetLineage'), shouldShowDatasetHealth: getConfig('shouldShowDatasetHealth'), wikiLinks: getConfig('wikiLinks') diff --git a/wherehows-web/app/services/configurator.ts b/wherehows-web/app/services/configurator.ts index 57514d6263..81955b59af 100644 --- a/wherehows-web/app/services/configurator.ts +++ b/wherehows-web/app/services/configurator.ts @@ -51,15 +51,21 @@ export default class Configurator extends Service { * @static * @template K * @param {K} [key] if provided, the value is returned with that key on the config hash is returned + * @param {IAppConfigOrProperty} [defaultValue] if provided, will default if key is not found in config * @returns {IAppConfigOrProperty} * @memberof Configurator */ - static getConfig(key?: K): IAppConfigOrProperty { + static getConfig( + key?: K, + defaultValue?: IAppConfigOrProperty + ): IAppConfigOrProperty { // Ensure that the application configuration has been successfully cached assert('Please ensure you have invoked the `load` method successfully prior to calling `getConfig`.', configLoaded); return typeof key === 'string' && appConfig.hasOwnProperty(key) ? >deepClone(appConfig[key]) - : >deepClone(appConfig); + : defaultValue !== undefined + ? defaultValue + : >deepClone(appConfig); } } diff --git a/wherehows-web/app/templates/components/dataset-aclaccess.hbs b/wherehows-web/app/templates/components/dataset-aclaccess.hbs index 3e025f70f3..700b58a230 100644 --- a/wherehows-web/app/templates/components/dataset-aclaccess.hbs +++ b/wherehows-web/app/templates/components/dataset-aclaccess.hbs @@ -217,7 +217,7 @@ {{empty-state heading="There are no users in this dataset's ACL" - subHead="If you feel this is in error, please contact ask_acl@linkedin.com" + subHead=(concat "If you feel this is in error, please contact " jitAclContact) }} {{/if}} diff --git a/wherehows-web/app/templates/components/datasets/containers/dataset-acl-access.hbs b/wherehows-web/app/templates/components/datasets/containers/dataset-acl-access.hbs index 503b77ccb8..af86faedb0 100644 --- a/wherehows-web/app/templates/components/datasets/containers/dataset-acl-access.hbs +++ b/wherehows-web/app/templates/components/datasets/containers/dataset-acl-access.hbs @@ -8,6 +8,7 @@ {{dataset-aclaccess acls=acls aclMoreInfoLink=@aclMoreInfoLink + jitAclContact=jitAclContact hasValidAclRequest=hasValidAclRequest userAclRequest=userAclRequest userHasAclAccess=userHasAclAccess diff --git a/wherehows-web/app/templates/datasets/dataset.hbs b/wherehows-web/app/templates/datasets/dataset.hbs index 4c39d319de..42d8b43cfb 100644 --- a/wherehows-web/app/templates/datasets/dataset.hbs +++ b/wherehows-web/app/templates/datasets/dataset.hbs @@ -164,6 +164,7 @@ urn=encodedUrn aclMoreInfoLink=wikiLinks.jitAcl isJitAclAccessEnabled=isJitAclAccessEnabled + jitAclContact=jitAclContact }} {{/tabs.tabpanel}} diff --git a/wherehows-web/app/typings/api/configurator/configurator.d.ts b/wherehows-web/app/typings/api/configurator/configurator.d.ts index d2ac9dbff5..f189dbb8bd 100644 --- a/wherehows-web/app/typings/api/configurator/configurator.d.ts +++ b/wherehows-web/app/typings/api/configurator/configurator.d.ts @@ -8,6 +8,7 @@ import { DatasetPlatform } from 'wherehows-web/constants'; interface IAppConfig { isInternal: boolean | void; JitAclAccessWhitelist: Array | void; + jitAclContact: string; shouldShowDatasetLineage: boolean; shouldShowDatasetHealth: boolean; // confidence threshold for filtering out higher quality suggestions From 2039444cc9644a73682cf3fd319db37da1d3e34e Mon Sep 17 00:00:00 2001 From: cptran777 Date: Tue, 11 Sep 2018 17:06:55 -0700 Subject: [PATCH 2/4] Fix typo --- wherehows-frontend/app/controllers/Application.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wherehows-frontend/app/controllers/Application.java b/wherehows-frontend/app/controllers/Application.java index b9c8eb2982..c46280059a 100644 --- a/wherehows-frontend/app/controllers/Application.java +++ b/wherehows-frontend/app/controllers/Application.java @@ -93,7 +93,7 @@ public class Application extends Controller { Play.application().configuration().getString("links.wiki.exportPolicy", ""); private static final String WHZ_LINKS__JIT_ACL_CONTACT = - Play.application().configuration().getString("links.jitAcl.contact") + Play.application().configuration().getString("links.jitAcl.contact"); private static final String DB_WHEREHOWS_URL = Play.application().configuration().getString("database.opensource.url"); From 2aa8fdebb53437ad9a087e366c6daddb7f540b84 Mon Sep 17 00:00:00 2001 From: cptran777 Date: Tue, 11 Sep 2018 18:05:20 -0700 Subject: [PATCH 3/4] Use put instead of set. Build works so this time we good --- wherehows-frontend/app/controllers/Application.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wherehows-frontend/app/controllers/Application.java b/wherehows-frontend/app/controllers/Application.java index c46280059a..670362bdab 100644 --- a/wherehows-frontend/app/controllers/Application.java +++ b/wherehows-frontend/app/controllers/Application.java @@ -93,7 +93,7 @@ public class Application extends Controller { Play.application().configuration().getString("links.wiki.exportPolicy", ""); private static final String WHZ_LINKS__JIT_ACL_CONTACT = - Play.application().configuration().getString("links.jitAcl.contact"); + Play.application().configuration().getString("links.jitAcl.contact", ""); private static final String DB_WHEREHOWS_URL = Play.application().configuration().getString("database.opensource.url"); @@ -212,7 +212,7 @@ public class Application extends Controller { config.put("suggestionConfidenceThreshold", Integer.parseInt(WHZ_SUGGESTION_CONFIDENCE_THRESHOLD)); config.set("wikiLinks", wikiLinks()); config.set("JitAclAccessWhitelist", Json.toJson(StringUtils.split(JIT_ACL_WHITELIST, ','))); - config.set("jitAclContact", WHZ_LINKS__JIT_ACL_CONTACT); + config.put("jitAclContact", WHZ_LINKS__JIT_ACL_CONTACT); config.set("tracking", trackingInfo()); // In a staging environment, we can trigger this flag to be true so that the UI can handle based on // such config and alert users that their changes will not affect production data From e69e64bb891cd00095dd943f8234774a0f3cf7e9 Mon Sep 17 00:00:00 2001 From: cptran777 Date: Wed, 12 Sep 2018 15:33:52 -0700 Subject: [PATCH 4/4] Modify configurator get to explicitly declare to use a default value instead of arbitrarily assuming --- wherehows-web/app/routes/datasets/dataset.ts | 2 +- wherehows-web/app/services/configurator.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wherehows-web/app/routes/datasets/dataset.ts b/wherehows-web/app/routes/datasets/dataset.ts index 840baaedb1..5e3bbe3d80 100644 --- a/wherehows-web/app/routes/datasets/dataset.ts +++ b/wherehows-web/app/routes/datasets/dataset.ts @@ -95,7 +95,7 @@ export default class DatasetRoute extends Route { setProperties(controller, { isInternal: !!getConfig('isInternal'), jitAclAccessWhitelist: getConfig('JitAclAccessWhitelist') || [], - jitAclContact: getConfig('jitAclContact', 'your ACL admin'), + jitAclContact: getConfig('jitAclContact', { useDefault: true, default: 'your ACL admin' }), shouldShowDatasetLineage: getConfig('shouldShowDatasetLineage'), shouldShowDatasetHealth: getConfig('shouldShowDatasetHealth'), wikiLinks: getConfig('wikiLinks') diff --git a/wherehows-web/app/services/configurator.ts b/wherehows-web/app/services/configurator.ts index 81955b59af..0ec034ad53 100644 --- a/wherehows-web/app/services/configurator.ts +++ b/wherehows-web/app/services/configurator.ts @@ -57,15 +57,15 @@ export default class Configurator extends Service { */ static getConfig( key?: K, - defaultValue?: IAppConfigOrProperty + options: { useDefault?: boolean; default?: IAppConfigOrProperty } = {} ): IAppConfigOrProperty { // Ensure that the application configuration has been successfully cached assert('Please ensure you have invoked the `load` method successfully prior to calling `getConfig`.', configLoaded); return typeof key === 'string' && appConfig.hasOwnProperty(key) ? >deepClone(appConfig[key]) - : defaultValue !== undefined - ? defaultValue + : options.useDefault + ? >options.default : >deepClone(appConfig); } }