cancel
Showing results for 
Search instead for 
Did you mean: 

Help with HiddenAspect?

pjaromin
Champ on-the-rise
Champ on-the-rise
I've recently discovered the sys:hidden aspect and have updated my project repo to 4.0.d from 4.0.b (using maven) to take advantage. I have a use case where the files should be hidden from view in Share, but available over CIFS/NFS for a separate process. Permissions won't work as the user does actually need to read/write from these hidden file/folders.

My problem is that I can't seem to get the mask to work properly. I wrote a quick utility using the code from HiddenAspect to construct what I believe are appropriate masks, and then set the sys:clientVisibilityMask accordingly. However, although the property is read just fine, the "client" is always NULL for non-web clients in HiddenAspect getVisibility() (line 468 of rev 35229).

For explorer and share I can get this visibility to turn on and off by changing the mask. Just not for any other client I've tested.

The mask I've most recently used was "41642" which according to my utililty should be:
Client cifs => Visible
Client imap => Visible
Client webdav => Visible
Client nfs => Visible
Client script => Visible
Client webclient => NotVisible
Client ftp => Visible
Client cmis => Visible

I'm thinking either this is a side effect of an improper mask, a missing/wrong configuration setting, or a bug. I've run out of time/energy to hunt this down any further tonight and thought I'd post here to see if someone had any insight or could provide guidance in the meantime.

Thanks!
5 REPLIES 5

pjaromin
Champ on-the-rise
Champ on-the-rise
Is there *anybody* out there who knows anything about the HiddenAspect?

I'd be happy to further track this down and file a bug report if I were certain I properly understood the expected behavior. If this is just a major misunderstanding on my part (which I accept as a distinct possibility based on my limited experience with Alfresco) then there's no point in me wasting further time trying to track this down.

I there someone who can at least confirm for me that I properly understand how this is supposed to work and that my masks are correct (or not)?

Thanks!

-Patrick

mrogers
Star Contributor
Star Contributor
Didn't understand this bit of your posting.   "However, although the property is read just fine, the "client" is always NULL for non-web clients in HiddenAspect getVisibility() (line 468 of rev 35229)."

That's the root of your problem.

Also I don't think its intended that you can hide for more than one client.   It may work, but that's not the intention of how it should work.

pjaromin
Champ on-the-rise
Champ on-the-rise
Thanks for the reply….

You can ignore the "property is read just fine" bit…I was just saying that the "clientVisibilityMask" property is being read and the expected value is there when I debug. But yes, the problem appears to be that at line 468 (of rev 35229) of HiddenAspect, the "client" value is NULL for all clients except the 'webclilent" and the method returns at that point without ever attempting to decode the mask.

So the question is *why* is 'client' null there, is this expected? I couldn't work out why this was the case - without understanding the intentions I found the code a bit difficult to work through and as it was late and I was way over time on this bit I thought I'd post to see if someone with some inside info might know something. I also noticed that this class has seen significant recent activity, leading me to think perhaps the version deployed with 4.0.d wasn't working but maybe a subsequent version is?

My use case requires hiding a node from the Share client ("all" web clients would be fine as well), but retaining visibility in at least the CIFS client. However no matter the mask I use, it's *always* hidden in all clients except the web client. The web client visibility does respond to the mask.

The mask is clearly *designed * to allow for granular visibility based on client, otherwise it would be entirely unnecessary (could simply have used a flag instead) - but has this full functionality been implemented/tested yet?

Thanks!

hoecake
Champ in-the-making
Champ in-the-making
Hi Patrick Jaromin,

I have same requirement, Have you got the right answer?

If I want show some docs on Share client but not on CIFS client, follow your inspirational topic, I think sys:clientVisibilityMask is good ideal.

thanks

vincent-kali
Star Contributor
Star Contributor

Hi all,

Code below should help you. I use it to hide working copy nodes for cifs/nfs/ftp clients using custom behaviours:

This code set sys:clientVisibilityMask to 166440

<code>

import org.alfresco.repo.model.filefolder.HiddenAspect;

import org.alfresco.repo.model.filefolder.HiddenAspect.Visibility;

.......

private HiddenAspect hiddenAspect = new HiddenAspect();

.....

int mask = 0;

// mask |= hiddenAspect.getClientVisibilityMask(Client.cifs, Visibility.HiddenAttribute);

mask |= hiddenAspect.getClientVisibilityMask(Client.cifs, Visibility.NotVisible);

mask |= hiddenAspect.getClientVisibilityMask(Client.imap, Visibility.Visible);

mask |= hiddenAspect.getClientVisibilityMask(Client.webdav, Visibility.Visible);

mask |= hiddenAspect.getClientVisibilityMask(Client.nfs, Visibility.NotVisible);

mask |= hiddenAspect.getClientVisibilityMask(Client.script, Visibility.Visible);

mask |= hiddenAspect.getClientVisibilityMask(Client.webclient, Visibility.Visible);

mask |= hiddenAspect.getClientVisibilityMask(Client.ftp, Visibility.NotVisible);

mask |= hiddenAspect.getClientVisibilityMask(Client.cmis, Visibility.Visible);

mask |= hiddenAspect.getClientVisibilityMask(Client.admin, Visibility.Visible);

Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);

props.put(ContentModel.PROP_VISIBILITY_MASK, mask);

props.put(ContentModel.PROP_HIDDEN_FLAG, true); // hidden regardless of file name patterns

this.services.getNodeService().addAspect(nodeRef, ContentModel.ASPECT_HIDDEN, props);

</code>

Getting started

Tags


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.