Commit a7870cde by kalyanikk Committed by Madhan Neethiraj

ATLAS-1502: added configuration to restrict entity-types editable via UI

parent c8f9f363
...@@ -407,3 +407,7 @@ legend.scheduler-border { ...@@ -407,3 +407,7 @@ legend.scheduler-border {
.topMargin { .topMargin {
margin-top: 13px; margin-top: 13px;
} }
.entityLink {
font-size: 16px;
}
...@@ -182,6 +182,16 @@ require(['App', ...@@ -182,6 +182,16 @@ require(['App',
if (response && response['atlas.entity.update.allowed'] !== undefined) { if (response && response['atlas.entity.update.allowed'] !== undefined) {
Globals.entityUpdate = response['atlas.entity.update.allowed']; Globals.entityUpdate = response['atlas.entity.update.allowed'];
} }
if (response && response['atlas.ui.editable.entity.types'] !== undefined) {
var entityTypeList = response['atlas.ui.editable.entity.types'].trim().split(",");
if (entityTypeList.length) {
if (entityTypeList[0] === "*") {
Globals.entityTypeConfList = [];
} else if (entityTypeList.length > 0) {
Globals.entityTypeConfList = entityTypeList;
}
}
}
App.start(); App.start();
} }
}); });
......
...@@ -171,7 +171,6 @@ define([ ...@@ -171,7 +171,6 @@ define([
'collection': that.tagCollection 'collection': that.tagCollection
})); }));
} else { } else {
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(tagName); App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(tagName);
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
} }
...@@ -191,7 +190,9 @@ define([ ...@@ -191,7 +190,9 @@ define([
'views/site/Header', 'views/site/Header',
'views/business_catalog/BusinessCatalogLayoutView', 'views/business_catalog/BusinessCatalogLayoutView',
'views/business_catalog/SideNavLayoutView', 'views/business_catalog/SideNavLayoutView',
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView) { 'views/search/SearchDetailLayoutView',
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
App.rNHeader.show(new Header({ 'globalVent': that.globalVent })); App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ App.rSideNav.show(new SideNavLayoutView({
...@@ -206,8 +207,16 @@ define([ ...@@ -206,8 +207,16 @@ define([
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(undefined, true); App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(undefined, true);
} }
} }
App.rNContent.$el.html(''); if (Globals.entityCreate && Utils.getUrlState.isSearchTab()) {
App.rNContent.show(new SearchDetailLayoutView({
'globalVent': that.globalVent,
'value': paramObj,
'initialView': true
}))
} else {
App.rNContent.$el.html("");
App.rNContent.destroy(); App.rNContent.destroy();
}
}); });
}, },
searchResult: function() { searchResult: function() {
...@@ -232,7 +241,8 @@ define([ ...@@ -232,7 +241,8 @@ define([
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
App.rNContent.show(new SearchDetailLayoutView({ App.rNContent.show(new SearchDetailLayoutView({
'globalVent': that.globalVent, 'globalVent': that.globalVent,
'value': paramObj 'value': paramObj,
'initialView': paramObj.query.trim().length === 0
})); }));
}); });
}, },
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<a href="javascript:void(0);" class="backButton" data-id="backButton"><i class="fa fa-chevron-left"></i> Back To Results</a> <a href="javascript:void(0);" class="backButton" data-id="backButton"><i class="fa fa-chevron-left"></i> Back To Results</a>
</div> </div>
<h1><span data-id="title"></span></h1> {{#if entityUpdate}} <h1><span data-id="title"></span></h1> {{#if entityUpdate}}
<button data-id="editButton" class="btn btn-default pull-right editbutton" id="editText"><i class="fa fa-pencil"></i></button> <button data-id="editButton" style="display:none" class="btn btn-default pull-right editbutton" id="editText"><i class="fa fa-pencil"></i></button>
{{/if}} {{/if}}
<div class="tagTerm"> <div class="tagTerm">
<span class="tagSpan">Tags:</span> <span class="tagSpan">Tags:</span>
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
--> -->
<div class="row row-margin-bottom"> <div class="row row-margin-bottom">
{{#if entityCreate}}
<div class="col-sm-12">
<button class="btn btn-atlasAction btn-atlas pull-left" data-id="createEntity"><i class="fa fa-plus"></i> Create Entity</button>
</div>
{{/if}}
<div class="col-sm-12" style="margin:15px 0px;"> <div class="col-sm-12" style="margin:15px 0px;">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
......
...@@ -32,6 +32,14 @@ ...@@ -32,6 +32,14 @@
</ul> </ul>
</div> </div>
<div id="r_searchResultTableLayoutView"> <div id="r_searchResultTableLayoutView">
{{#if entityCreate}}
<div class="entityLink" style="display:none">
<h1><b>Atlas Search</b></h1>
<p class="entityLink">Search Atlas for existing entities or
<a href="javascript:void(0)" data-id='createEntity'> create new entity </a><i class="fa fa-question-circle" aria-hidden="true"></i>
</p>
</div>
{{/if}}
</div> </div>
</div> </div>
</div> </div>
...@@ -40,6 +40,15 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -40,6 +40,15 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
}) })
]); ]);
} }
_.mixin({
isEmptyArray: function(val) {
if (val && _.isArray(val)) {
return _.isEmpty(val);
} else {
return false;
}
}
});
// For placeholder support // For placeholder support
if (!('placeholder' in HTMLInputElement.prototype)) { if (!('placeholder' in HTMLInputElement.prototype)) {
......
...@@ -147,7 +147,7 @@ define(['require', ...@@ -147,7 +147,7 @@ define(['require',
that.$('.fontLoader').hide(); that.$('.fontLoader').hide();
that.$('.auditTable').show(); that.$('.auditTable').show();
that.renderOffset(options); that.renderOffset(options);
if ((that.entityCollection.models.length < that.count && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) { if (that.entityCollection && (that.entityCollection.models.length < that.count && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) {
options.next.attr('disabled', true); options.next.attr('disabled', true);
options.previous.removeAttr("disabled"); options.previous.removeAttr("disabled");
} else { } else {
......
...@@ -20,8 +20,9 @@ define(['require', ...@@ -20,8 +20,9 @@ define(['require',
'backbone', 'backbone',
'hbs!tmpl/audit/CreateAuditTableLayoutView_tmpl', 'hbs!tmpl/audit/CreateAuditTableLayoutView_tmpl',
'utils/Enums', 'utils/Enums',
'utils/CommonViewFunction' 'utils/CommonViewFunction',
], function(require, Backbone, CreateAuditTableLayoutViewTmpl, Enums, CommonViewFunction) { 'utils/Utils'
], function(require, Backbone, CreateAuditTableLayoutViewTmpl, Enums, CommonViewFunction, Utils) {
'use strict'; 'use strict';
var CreateAuditTableLayoutView = Backbone.Marionette.LayoutView.extend( var CreateAuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -65,11 +66,17 @@ define(['require', ...@@ -65,11 +66,17 @@ define(['require',
if (this.entityModel.get('details').search('{') >= 0) { if (this.entityModel.get('details').search('{') >= 0) {
var appendedString = "{" + this.entityModel.get('details') + "}"; var appendedString = "{" + this.entityModel.get('details') + "}";
var auditData = appendedString.split('"')[0].split(':')[0].split("{")[1]; var auditData = appendedString.split('"')[0].split(':')[0].split("{")[1];
try {
var detailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData]; var detailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData];
} catch (err) {
Utils.serverErrorHandler();
}
//Append string for JSON parse //Append string for JSON parse
if (detailsObject) {
var valueObject = detailsObject.values; var valueObject = detailsObject.values;
if (this.action == Enums.auditAction.TAG_ADD) { }
this.ui.auditHeaderValue.html('<th>' + Enums.auditAction.TAG_ADD + '</th>'); if ((this.action == Enums.auditAction.TAG_ADD || Enums.auditAction.ENTITY_CREATE) && detailsObject) {
this.ui.auditHeaderValue.html('<th>' + (this.action === Enums.auditAction.ENTITY_CREATE ? Enums.auditAction.ENTITY_CREATE : Enums.auditAction.TAG_ADD) + '</th>');
this.ui.auditValue.html("<tr><td>" + _.escape(detailsObject.typeName) + "</td></tr>"); this.ui.auditValue.html("<tr><td>" + _.escape(detailsObject.typeName) + "</td></tr>");
} else { } else {
this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>'); this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>');
...@@ -84,9 +91,8 @@ define(['require', ...@@ -84,9 +91,8 @@ define(['require',
} }
} }
} else if (this.action == Enums.auditAction.TAG_DELETE || Enums.auditAction.ENTITY_DELETE) { } else if (this.action == Enums.auditAction.TAG_DELETE || Enums.auditAction.ENTITY_DELETE) {
//var appendedString = this.entityModel.get('details').split(':'); this.ui.auditHeaderValue.html('<th>' + Enums.auditAction.TAG_DELETE || Enums.auditAction.ENTITY_DELETE + '</th>');
this.ui.auditHeaderValue.html('<th>' + this.action + '</th>'); this.ui.auditValue.html("<tr><td>" + (this.entityObject.name || this.entityObject.qualifiedName) + "</td></tr>");
this.ui.auditValue.html("<tr><td>" + this.entityObject.name + "</td></tr>");
} }
}, },
......
...@@ -164,13 +164,21 @@ define(['require', ...@@ -164,13 +164,21 @@ define(['require',
} else { } else {
this.addTagToTerms([]); this.addTagToTerms([]);
} }
if (Globals.entityTypeConfList && _.isEmptyArray(Globals.entityTypeConfList)) {
this.ui.editButton.show();
} else {
if (_.contains(Globals.entityTypeConfList, collectionJSON.typeName)) {
this.ui.editButton.show();
}
}
} }
this.hideLoader(); this.hideLoader();
this.auditVent.trigger("reset:collection");
this.renderEntityDetailTableLayoutView(); this.renderEntityDetailTableLayoutView();
this.renderAuditTableLayoutView(this.id, collectionJSON.attributes);
this.renderTagTableLayoutView(tagGuid); this.renderTagTableLayoutView(tagGuid);
this.renderTermTableLayoutView(tagGuid); this.renderTermTableLayoutView(tagGuid);
this.renderAuditTableLayoutView(this.id, collectionJSON.attributes); this.renderLineageLayoutView(this.id);
this.renderSchemaLayoutView(this.id);
}, this); }, this);
this.listenTo(this.collection, 'error', function(model, response) { this.listenTo(this.collection, 'error', function(model, response) {
this.$('.fontLoader').hide(); this.$('.fontLoader').hide();
...@@ -185,9 +193,6 @@ define(['require', ...@@ -185,9 +193,6 @@ define(['require',
var that = this; var that = this;
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail')); Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail'));
this.$('.fontLoader').show(); // to show tab loader this.$('.fontLoader').show(); // to show tab loader
this.renderLineageLayoutView(this.id);
this.renderSchemaLayoutView(this.id);
}, },
fetchCollection: function() { fetchCollection: function() {
this.collection.fetch({ reset: true }); this.collection.fetch({ reset: true });
......
...@@ -43,7 +43,7 @@ define(['require', ...@@ -43,7 +43,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'value')); _.extend(this, _.pick(options, 'globalVent', 'value', 'initialView'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -63,7 +63,8 @@ define(['require', ...@@ -63,7 +63,8 @@ define(['require',
if (that.RSearchResultLayoutView) { if (that.RSearchResultLayoutView) {
that.RSearchResultLayoutView.show(new SearchResultLayoutView({ that.RSearchResultLayoutView.show(new SearchResultLayoutView({
value: value, value: value,
tag: that.tag tag: that.tag,
initialView: that.initialView
})); }));
} }
}); });
......
...@@ -43,14 +43,7 @@ define(['require', ...@@ -43,14 +43,7 @@ define(['require',
searchBtn: '[data-id="searchBtn"]', searchBtn: '[data-id="searchBtn"]',
clearSearch: '[data-id="clearSearch"]', clearSearch: '[data-id="clearSearch"]',
typeLov: '[data-id="typeLOV"]', typeLov: '[data-id="typeLOV"]',
refreshBtn: '[data-id="refreshBtn"]', refreshBtn: '[data-id="refreshBtn"]'
createEntity: "[data-id='createEntity']",
},
templateHelpers: function() {
return {
entityCreate: Globals.entityCreate
};
}, },
/** ui events hash */ /** ui events hash */
...@@ -72,7 +65,6 @@ define(['require', ...@@ -72,7 +65,6 @@ define(['require',
events["click " + this.ui.clearSearch] = 'clearSearchData'; events["click " + this.ui.clearSearch] = 'clearSearchData';
events["change " + this.ui.typeLov] = 'onChangeTypeList'; events["change " + this.ui.typeLov] = 'onChangeTypeList';
events["click " + this.ui.refreshBtn] = 'onRefreshButton'; events["click " + this.ui.refreshBtn] = 'onRefreshButton';
events["click " + this.ui.createEntity] = 'onClickCreateEntity';
return events; return events;
}, },
/** /**
...@@ -132,7 +124,9 @@ define(['require', ...@@ -132,7 +124,9 @@ define(['require',
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
} }
this.typecollection.fullCollection.sort().each(function(model) { this.typecollection.fullCollection.sort().each(function(model) {
if (model.get('category') == 'ENTITY') {
str += '<option>' + _.escape(model.get("name")) + '</option>'; str += '<option>' + _.escape(model.get("name")) + '</option>';
}
}); });
that.ui.typeLov.html(str); that.ui.typeLov.html(str);
}, },
...@@ -257,20 +251,7 @@ define(['require', ...@@ -257,20 +251,7 @@ define(['require',
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true trigger: true
}); });
},
onClickCreateEntity: function(e) {
var that = this;
$(e.currentTarget).blur();
require([
'views/entity/CreateEntityLayoutView'
], function(CreateEntityLayoutView) {
var view = new CreateEntityLayoutView({
callback: function() {
that.fetchCollection();
} }
}); });
});
},
});
return SearchLayoutView; return SearchLayoutView;
}); });
...@@ -58,9 +58,14 @@ define(['require', ...@@ -58,9 +58,14 @@ define(['require',
nextData: "[data-id='nextData']", nextData: "[data-id='nextData']",
pageRecordText: "[data-id='pageRecordText']", pageRecordText: "[data-id='pageRecordText']",
addAssignTag: "[data-id='addAssignTag']", addAssignTag: "[data-id='addAssignTag']",
editEntityButton: "[data-id='editEntityButton']" editEntityButton: "[data-id='editEntityButton']",
createEntity: "[data-id='createEntity']",
},
templateHelpers: function() {
return {
entityCreate: Globals.entityCreate
};
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
var events = {}; var events = {};
...@@ -109,6 +114,7 @@ define(['require', ...@@ -109,6 +114,7 @@ define(['require',
events["click " + this.ui.nextData] = "onClicknextData"; events["click " + this.ui.nextData] = "onClicknextData";
events["click " + this.ui.previousData] = "onClickpreviousData"; events["click " + this.ui.previousData] = "onClickpreviousData";
events["click " + this.ui.editEntityButton] = "onClickEditEntity"; events["click " + this.ui.editEntityButton] = "onClickEditEntity";
events["click " + this.ui.createEntity] = 'onClickCreateEntity';
return events; return events;
}, },
/** /**
...@@ -116,7 +122,7 @@ define(['require', ...@@ -116,7 +122,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'vent', 'value')); _.extend(this, _.pick(options, 'globalVent', 'vent', 'value', 'initialView'));
var pagination = ""; var pagination = "";
this.entityModel = new VEntity(); this.entityModel = new VEntity();
this.searchCollection = new VSearchList(); this.searchCollection = new VSearchList();
...@@ -178,6 +184,7 @@ define(['require', ...@@ -178,6 +184,7 @@ define(['require',
}, this); }, this);
}, },
onRender: function() { onRender: function() {
if (!this.initialView) {
var value = {}, var value = {},
that = this; that = this;
if (this.value) { if (this.value) {
...@@ -198,6 +205,11 @@ define(['require', ...@@ -198,6 +205,11 @@ define(['require',
that.$('.popover.popoverTag').hide(); that.$('.popover.popoverTag').hide();
} }
}); });
} else {
if (Globals.entityTypeConfList) {
this.$(".entityLink").show();
}
}
}, },
fetchCollection: function(value) { fetchCollection: function(value) {
var that = this; var that = this;
...@@ -264,13 +276,16 @@ define(['require', ...@@ -264,13 +276,16 @@ define(['require',
} }
var resultData = 'Results for <b>' + _.escape(that.searchCollection.queryParams.query) + '</b>'; var resultData = 'Results for <b>' + _.escape(that.searchCollection.queryParams.query) + '</b>';
var multiAssignDataTag = '<a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i>' + " " + 'Assign Tag</a>'; var multiAssignDataTag = '<a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i>' + " " + 'Assign Tag</a>';
var resultText = that.searchCollection.queryParams.query;
var multiAssignDataTerm = "",
createEntityTag = "";
if (Globals.taxonomy) { if (Globals.taxonomy) {
var multiAssignDataTerm = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a>'; multiAssignDataTerm = '<a href="javascript:void(0)" class="inputAssignTag multiSelect" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a>';
that.$('.searchResult').html(resultData + multiAssignDataTerm + multiAssignDataTag);
} else {
that.$('.searchResult').html(resultData + multiAssignDataTag);
} }
if (Globals.entityCreate && (resultText.indexOf("\`") != 0) && Globals.entityTypeConfList) {
createEntityTag = "<p>If you do not find the entity in search result below then you can" + '<a href="javascript:void(0)" data-id="createEntity"> create new entity</a></p>';
}
that.$('.searchResult').html(resultData + multiAssignDataTag + multiAssignDataTerm + createEntityTag);
}, },
silent: true, silent: true,
reset: true reset: true
...@@ -341,8 +356,14 @@ define(['require', ...@@ -341,8 +356,14 @@ define(['require',
return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>'; return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else { } else {
if (Globals.entityUpdate) { if (Globals.entityUpdate) {
if (Globals.entityTypeConfList && _.isEmptyArray(Globals.entityTypeConfList)) {
nameHtml += '<button title="Edit" data-id="editEntityButton" data-giud= "' + obj.guid + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
} else {
if (_.contains(Globals.entityTypeConfList, obj.typeName)) {
nameHtml += '<button title="Edit" data-id="editEntityButton" data-giud= "' + obj.guid + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>' nameHtml += '<button title="Edit" data-id="editEntityButton" data-giud= "' + obj.guid + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
} }
}
}
return nameHtml; return nameHtml;
} }
} }
...@@ -606,6 +627,19 @@ define(['require', ...@@ -606,6 +627,19 @@ define(['require',
} }
}); });
}); });
},
onClickCreateEntity: function(e) {
var that = this;
$(e.currentTarget).blur();
require([
'views/entity/CreateEntityLayoutView'
], function(CreateEntityLayoutView) {
var view = new CreateEntityLayoutView({
callback: function() {
that.fetchCollection();
}
});
});
} }
}); });
return SearchResultLayoutView; return SearchResultLayoutView;
......
...@@ -98,8 +98,8 @@ define(['require', ...@@ -98,8 +98,8 @@ define(['require',
}); });
} }
if (obj.skipEntity.length) { if (obj.skipEntity.length) {
var text = "<b>" + obj.skipEntity.join(', ') + var text = "<b>" + obj.skipEntity.length + " of " + that.multiple.length +
"</b> <br/> entities selected have already been associated with <b>" + tagName + "</b> entities selected have already been associated with <b>" + tagName +
"</b> tag, Do you want to associate the tag with other entities ?", "</b> tag, Do you want to associate the tag with other entities ?",
removeCancelButton = false; removeCancelButton = false;
if ((obj.skipEntity.length + obj.deletedEntity.length) === that.multiple.length) { if ((obj.skipEntity.length + obj.deletedEntity.length) === that.multiple.length) {
......
...@@ -48,6 +48,7 @@ import javax.ws.rs.core.MediaType; ...@@ -48,6 +48,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
...@@ -65,6 +66,8 @@ public class AdminResource { ...@@ -65,6 +66,8 @@ public class AdminResource {
private static final String isTaxonomyEnabled = "atlas.feature.taxonomy.enable"; private static final String isTaxonomyEnabled = "atlas.feature.taxonomy.enable";
private static final String isEntityUpdateAllowed = "atlas.entity.update.allowed"; private static final String isEntityUpdateAllowed = "atlas.entity.update.allowed";
private static final String isEntityCreateAllowed = "atlas.entity.create.allowed"; private static final String isEntityCreateAllowed = "atlas.entity.create.allowed";
private static final String editableEntityTypes = "atlas.ui.editable.entity.types";
private static final String DEFAULT_EDITABLE_ENTITY_TYPES = "hdfs_path,hdfs_path,hbase_table,hbase_column,hbase_column_family,kafka_topic";
private Response version; private Response version;
private ServiceState serviceState; private ServiceState serviceState;
private MetricsService metricsService; private MetricsService metricsService;
...@@ -213,6 +216,7 @@ public class AdminResource { ...@@ -213,6 +216,7 @@ public class AdminResource {
responseData.put(isTaxonomyEnabled, enableTaxonomy); responseData.put(isTaxonomyEnabled, enableTaxonomy);
responseData.put(isEntityUpdateAllowed, isEntityUpdateAccessAllowed); responseData.put(isEntityUpdateAllowed, isEntityUpdateAccessAllowed);
responseData.put(isEntityCreateAllowed, isEntityCreateAccessAllowed); responseData.put(isEntityCreateAllowed, isEntityCreateAccessAllowed);
responseData.put(editableEntityTypes, getEditableEntityTypes(configProperties));
responseData.put("userName", userName); responseData.put("userName", userName);
responseData.put("groups", groups); responseData.put("groups", groups);
...@@ -244,4 +248,30 @@ public class AdminResource { ...@@ -244,4 +248,30 @@ public class AdminResource {
return metrics; return metrics;
} }
private String getEditableEntityTypes(PropertiesConfiguration config) {
String ret = DEFAULT_EDITABLE_ENTITY_TYPES;
if (config.containsKey(editableEntityTypes)) {
Object value = config.getProperty(editableEntityTypes);
if (value instanceof String) {
ret = (String)value;
} else if (value instanceof Collection) {
StringBuilder sb = new StringBuilder();
for (Object elem : ((Collection)value)) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(elem.toString());
}
ret = sb.toString();
}
}
return ret;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment