Skip to content

Commit

Permalink
fix: cleanup/remove unnecessary parts
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlukasse committed May 15, 2024
1 parent 550ccb2 commit 1b4b8e7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 62 deletions.
1 change: 0 additions & 1 deletion js/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ define([
const apiPaths = {
role: (id = '') => `${config.api.url}role/${id}`,
roleUsers: roleId => `${config.api.url}role/${roleId}/users`,
userRoles: userId => `${config.api.url}user/${userId}/roles`,
permissions: () => `${config.api.url}permission`,
rolePermissions: roleId => `${config.api.url}role/${roleId}/permissions`,
relations: (roleId, relation, ids = []) => `${config.api.url}role/${roleId}/${relation}/${ids.join('+')}`,
Expand Down
21 changes: 9 additions & 12 deletions js/pages/cohort-definitions/cohort-definition-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ define(['jquery', 'knockout', 'text!./cohort-definition-manager.html',
'appConfig',
'components/cohortbuilder/CohortDefinition',
'services/CohortDefinition',
'services/ShareRoleCheck',
'services/MomentAPI',
'services/ConceptSet',
'services/Permission',
Expand Down Expand Up @@ -66,8 +65,7 @@ define(['jquery', 'knockout', 'text!./cohort-definition-manager.html',
view,
config,
CohortDefinition,
cohortDefinitionService,
shareRoleCheck,
cohortDefinitionService,
momentApi,
conceptSetService,
PermissionService,
Expand Down Expand Up @@ -201,15 +199,14 @@ define(['jquery', 'knockout', 'text!./cohort-definition-manager.html',
this.authApi = authApi;
this.config = config;

this.enablePermissionManagement = ko.observable(false);
this.enablePermissionManagement(config.enablePermissionManagement);

this.userCanShare = ko.observable(false);
if (config.permissionManagementRoleId === "") {
this.userCanShare(true);
} else {
this.userCanShare(authApi.isPermittedGlobalShareCohort());
}
this.enablePermissionManagement = ko.observable(config.enablePermissionManagement);
if (config.enablePermissionManagement) {
this.userCanShare = ko.observable(
!config.limitedPermissionManagement ||
authApi.isPermittedGlobalShareCohort());
} else {
this.userCanShare = ko.observable(false);
}

this.relatedSourcecodesOptions = globalConstants.relatedSourcecodesOptions;
this.commonUtils = commonUtils;
Expand Down
24 changes: 10 additions & 14 deletions js/pages/concept-sets/conceptset-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ define([
'./const',
'const',
'components/conceptset/utils',
'services/Vocabulary',
'services/ShareRoleCheck',
'services/Vocabulary',
'services/Permission',
'services/Tags',
'components/security/access/const',
Expand Down Expand Up @@ -56,8 +55,7 @@ define([
constants,
globalConstants,
utils,
vocabularyAPI,
shareRoleCheck,
vocabularyAPI,
GlobalPermissionService,
TagsService,
{ entityType },
Expand Down Expand Up @@ -177,17 +175,15 @@ define([
return this.currentConceptSet() && this.currentConceptSet().id > 0;
});

this.enablePermissionManagement = ko.observable(false);
this.enablePermissionManagement(config.enablePermissionManagement);

this.userCanShare = ko.observable(false);
if (config.permissionManagementRoleId === "") {
this.userCanShare(true);
} else {
this.userCanShare(authApi.isPermittedGlobalShareCohort());
}
this.enablePermissionManagement = ko.observable(config.enablePermissionManagement);
if (config.enablePermissionManagement) {
this.userCanShare = ko.observable(
!config.limitedPermissionManagement ||
authApi.isPermittedGlobalShareCohort());
} else {
this.userCanShare = ko.observable(false);
}


this.isSaving = ko.observable(false);
this.isDeleting = ko.observable(false);
this.isOptimizing = ko.observable(false);
Expand Down
3 changes: 0 additions & 3 deletions js/services/AuthAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ define(function(require, exports) {
var subject = ko.observable();
var permissions = ko.observable();
var fullName = ko.observable();
var userId = ko.observable();
const authProvider = ko.observable();

authProvider.subscribe(provider => {
Expand All @@ -83,7 +82,6 @@ define(function(require, exports) {
subject(info.login);
authProvider(jqXHR.getResponseHeader('x-auth-provider'));
fullName(info.name ? info.name : info.login);
userId(info.id);
resolve();
},
error: function (err) {
Expand Down Expand Up @@ -568,7 +566,6 @@ define(function(require, exports) {
reloginRequired: reloginRequired,
subject: subject,
fullName,
userId,
tokenExpirationDate: tokenExpirationDate,
tokenExpired: tokenExpired,
authProvider: authProvider,
Expand Down
32 changes: 0 additions & 32 deletions js/services/ShareRoleCheck.js

This file was deleted.

0 comments on commit 1b4b8e7

Please sign in to comment.