02-12-2020 10:57 AM
I need to hide the "Comments" and "Activity" section in the Document View and also disable all the corresponding actions for the Anonymous user - not to view nor write comments on any documents in any domain. I can not find a way to manage this in the nuxeo-web-ui-bundle.html through the slots. I'm not using Studio. Any ideas would be highly appreciated, thanks in advance!
02-12-2020 12:16 PM
Hello,
You have to override the default nuxeo-document-page.html So, basically:
<nuxeo-slot-content name="documentViewPage" slot="DOCUMENT_VIEWS_PAGES" order="10">
<template>
<nuxeo-filter document="[[document]]" expression="document.facets.indexOf('Folderish') === -1
&& document.facets.indexOf('Collection') === -1">
<template>
<nuxeo-document-page-v2 name="view" document="[[document]]" opened></nuxeo-partners-document-page-v2>
</template>
</nuxeo-filter>
</template>
</nuxeo-slot-content>
02-13-2020 01:40 AM
Thanks, Gregory, but I'm not using Studio and Designer. And I can't find "nuxeo-document-page.html" on my server too...
02-15-2020 05:28 AM
Hello [Anton Petrov](https
02-16-2020 01:25 PM
Hi, Rodri ! I managed to enable Anonymous user with the following contribution:
<?xml version="1.0"?>
<component name="org.nuxeo.ecm.platform.login.anonymous.config">
<require>org.nuxeo.ecm.platform.ui.web.auth.defaultConfig</require>
<require>org.nuxeo.ecm.platform.ui.web.auth.WebEngineConfig</require>
<require>org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService</require>
<!-- Add an Anonymous user -->
<extension target="org.nuxeo.ecm.platform.usermanager.UserService"
point="userManager">
<userManager>
<users>
<anonymousUser id="Guest">
<property name="firstName">Guest</property>
<property name="lastName">User</property>
</anonymousUser>
</users>
</userManager>
</extension>
<extension
target="org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService"
point="chain">
<authenticationChain>
<plugins>
<plugin>BASIC_AUTH</plugin>
<plugin>FORM_AUTH</plugin>
<plugin>ANONYMOUS_AUTH</plugin>
</plugins>
</authenticationChain>
</extension>
</component>
Don't forget to add your contribution in the MANIFEST.MF of your bundle, something like:
Bundle-ActivationPolicy: lazy
------
------
Nuxeo-Component: OSGI-INF/anonymous-auth-config.xml
I also had the same problem as you and asked in stackoverflow without adequate answer: https://stackoverflow.com/questions/57058139/nuxeo-after-activating-the-anonymous-user-cant-log-in
The problem persists on my test Windows 10 installation, but on the ubuntu server installation the same contribution works ok without any issues. The odd thing I discovered by chance is that opening an **incognito window ** on my local Windows installation works fine, giving me the ability to log as Administrator and as the Guest!
04-07-2020 05:33 PM
Hi, [Rodri ](https
02-22-2020 05:32 AM
Hello,
thank you Anton Petrov for the information to use the anonymous authentication. In my case, even in "incognito" window in Chrome, it didn't work. I needed to clear my cookies everytime I wanted to login as Administrator. I think there is a bug for windows in this authentication method.
Anyway, I have been trying to hide the Comments and Activity sections from the document view without success, and I don't know if it is possible. As Gregory Carlin said, I have created my own "nuxeo-document-page" contribution like follows:
<dom-module id="nuxeo-document-page-v2" assetpath="document/">
<template>
<style include="nuxeo-styles">
#details {
width: 28px;
height: 28px;
padding: 5px;
opacity: 0.3;
margin: 6px 0;
}
:host([opened]) #details {
opacity: 1;
margin-left: 6px;
}
#documentViewsItems {
@apply --layout-horizontal;
--paper-listbox-background-color: transparent;
}
#documentViewsItems > [name='comments'] {
margin: 0;
}
.scrollerHeader {
@apply --layout-horizontal;
}
:host([opened]) .scrollerHeader {
box-shadow: 0 3px 5px rgba(0,0,0,0.04) !important;
border-radius: 0;
background-color: var(--nuxeo-box) !important;
}
.page {
@apply --layout-horizontal;
}
.main {
@apply --layout-vertical;
@apply --layout-flex-2;
padding-right: 8px;
overflow: hidden;
}
:host([opened]) .main {
padding-right: 16px;
}
.side {
@apply --layout-vertical;
position: relative;
margin-bottom: var(--nuxeo-card-margin-bottom, 16px);
min-height: 60vh;
}
:host([opened]) .side {
@apply --layout-flex;
}
.scroller {
@apply --nuxeo-card;
margin-bottom: 0;
overflow: auto;
display: none;
left: 0;
top: 36px;
right: 0;
bottom: 0;
position: absolute;
}
:host([opened]) .scroller {
display: block;
}
.section {
margin-bottom: 32px;
}
.section:last-of-type {
margin-bottom: 64px;
}
nuxeo-document-view {
--nuxeo-document-content-margin-bottom: var(--nuxeo-card-margin-bottom);
}
@media (max-width: 1024px) {
#details {
opacity: 1;
margin-left: 6px;
cursor: default;
}
.scrollerHeader {
box-shadow: 0 3px 5px rgba(0,0,0,0.04) !important;
font-family: var(--nuxeo-app-font);
border-radius: 0;
background-color: var(--nuxeo-box) !important;
}
.page {
@apply --layout-vertical;
}
.main,
:host([opened]) .main {
padding: 0;
max-width: initial;
margin-right: 0;
}
.side {
padding: 0;
max-width: initial;
min-height: initial;
display: block;
margin-bottom: 16px;
}
.scroller {
top: 0;
position: relative;
display: block;
}
}
</style>
<nuxeo-document-info-bar document="[[document]]"></nuxeo-document-info-bar>
<div class="page">
<div class="main">
<nuxeo-document-view document="[[document]]"></nuxeo-document-view>
</div>
<div class="side">
<div class="scrollerHeader">
<paper-icon-button id="details" noink="" icon="nuxeo:details" on-tap="_toggleOpened"></paper-icon-button>
<nuxeo-tooltip for="details">[[i18n('documentPage.details.opened')]]</nuxeo-tooltip>
</div>
<div class="scroller">
<div class="section">
<nuxeo-document-info document="[[document]]"></nuxeo-document-info>
</div>
<div class="section">
<nuxeo-document-metadata document="[[document]]"></nuxeo-document-metadata>
</div>
<div class="section" hidden$="[[!_hasCollections(document)]]">
<h3>[[i18n('documentPage.collections')]]</h3>
<nuxeo-document-collections document="[[document]]"></nuxeo-document-collections>
</div>
<template is="dom-if" if="[[hasFacet(document, 'NXTag')]]">
<div class="section">
<h3>[[i18n('documentPage.tags')]]</h3>
<nuxeo-tag-suggestion document="[[document]]" allow-new-tags="" placeholder="[[i18n('documentPage.tags.placeholder')]]" readonly="[[!isTaggable(document)]]">
</nuxeo-tag-suggestion>
</div>
</template>
<div class="section">
<paper-listbox id="documentViewsItems" selected="{{selectedTab}}" attr-for-selected="name">
<nuxeo-page-item name="comments" label="[[i18n('documentPage.comments')]]"></nuxeo-page-item>
<nuxeo-page-item name="activity" label="[[i18n('documentPage.activity')]]"></nuxeo-page-item>
</paper-listbox>
<iron-pages selected="[[selectedTab]]" attr-for-selected="name" selected-item="{{page}}">
<nuxeo-document-comment-thread name="comments" uid="[[document.uid]]"></nuxeo-document-comment-thread>
<nuxeo-document-activity name="activity" document="[[document]]"></nuxeo-document-activity>
</iron-pages>
</div>
</div>
</div>
</div>
</template>
<script>
Polymer({
is: 'nuxeo-document-page-v2',
behaviors: [Nuxeo.LayoutBehavior],
properties: {
document: {
type: Object
},
selectedTab: {
type: String,
value: 'comments',
notify: true
},
opened: {
type: Boolean,
value: false,
notify: true,
reflectToAttribute: true,
observer: '_openedChanged',
}
},
_openedChanged: function() {
Polymer.Async.animationFrame.run(function() {
// notify that there was a resize
this.dispatchEvent(new CustomEvent('resize', {
bubbles: false,
composed: true,
}));
});
},
_toggleOpened: function() {
this.opened = !this.opened;
},
_isMutable: function(doc) {
return !this.hasFacet(doc, 'Immutable') && doc.type !== 'Root' && !this.isTrashed(doc);
},
_hasCollections: function(doc) {
return this.hasCollections(doc);
}
});
</script>
</dom-module>
<link rel="import" href="nuxeo-document-page-v2.html">
<nuxeo-slot-content name="documentViewPage" slot="DOCUMENT_VIEWS_PAGES" order="10">
<template>
<nuxeo-filter document="[[document]]" expression="document.facets.indexOf('Folderish') === -1
&& document.facets.indexOf('Collection') === -1">
<template>
<nuxeo-document-page-v2 name="view" document="[[document]]" opened=""></nuxeo-document-page-v2>
</template>
</nuxeo-filter>
</template>
</nuxeo-slot-content>
Both files are located in the same directory in my project, in web/nuxeo.war/ui.
<extension target="org.nuxeo.ecm.platform.WebResources" point="resources">
<resource name="nuxeo-custom-none-bundle.html" type="import" shrinkable="false">
<uri>/ui/nuxeo-custom-none-bundle.html</uri>
</resource>
</extension>
<extension target="org.nuxeo.ecm.platform.WebResources" point="bundles">
<bundle name="web-ui">
<resources append="true">
<resource>nuxeo-custom-none-bundle.html</resource>
</resources>
</bundle>
</extension>
The contribution seems to be working properly, as when I access to a document, I can see that the module loaded is the "nuxeo-document-page-v2" as expected:
However, without modifying anything in the copied dom-module, it doesn't work as expected, as for example the comments tab is empty when the document has comments. This only happens if I am logged as Anonymous user (yes, I know that this is what we want to achieve, but this happens because of an error, not because of a filter for anonymous users).
Anyway, what I have tried to do is to use a nuxeo-filter to remove the full "Comments & Activity" section according to user.isAnonymous property, but then I found another problem: we don't have the "user" object in that module!
I tried to modify the slot contriution as follows in order to get the "user" object in the module:
<nuxeo-document-page-v2 name="view" document="[[document]]" user="[[user]]" opened=""></nuxeo-document-page-v2>
And I also added it in "properties", inside the Polymer object in the nuxeo-document-page-v2.html file, after the "document" property:
user: {
type: Object
},
However, the behaviour is really strange, as when I try to use the "user" object, sometimes it is the user, sometimes it is the document, and sometimes it is undefined. So I don't understand what's happening here.
Sorry for not being able to be more helpful. I will keep trying to make it work.
Regards.
02-27-2020 07:34 AM
HI, [Rodri ](https
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.