Globals url or href links blank when no permission on target asset


(Warwick Barnes) #1

G'day,

 

Using Matrix 4.18.4, if we have the following two links in a design file:

<a href="./?a=12345">Science</a>
<a href="%globals_asset_url:12345%">Science</a>

Then the output is the same:

<a href="http://site.aad.gov.au/science">Science</a>
<a href="http://site.aad.gov.au/science">Science</a>

If the user viewing the page doesn't have permissions to view asset id 12345 (e.g if its status is set to 'under construction') then the output is:

<a href="http://site.aad.gov.au/science">Science</a>
<a href="">Science</a>

Is this difference a bug or a feature of the system?

 

Is there any reason to prefer the use of the globals keyword replacement or the ?a=12345 style of links in design files? Is one way more recommended than the other?

 

Thanks,

 

Warwick


#2

We have used globals in css files - but not design files. Hopefully Bart will see this. This looks buggy. Is it hardcoded inthe design file or a nest region? Is there are reason why your leaviing your parse file under construction?.


(Ashish Karelia) #3

Using ./?=xxx works fine as the replacement is done at a higher level than the permission checking.

Using globals keywords does the permission checking as those keywords can be used to show asset attributes (which you may not wanna show the users who have enough permissions).

 

From what I can understand and see in the code it's been this way from start. Not sure if it can be termed as a bug but a bit of inconsistent behaviour. 

I'll let Bart comment on this one further.

 

Ash


(Bart Banda) #4

Hi Warwick, it's like Ash says, the way the permission checking is done for global keywords has been that way for a very long time.

 

What's the reason for printing some URLs in one way, and some in another using globals? Can't you change them all to use ./?a=  ?

 

You could use a keyword modifier on the globals keyword to print something else if it returns empty. I'm also not sure why you would want to print a link to an asset that is under construction anyways, would be interested to hear the requirement for this. 


(Warwick Barnes) #5

G'day … thank you all for your responses, which are really helpful.

 

We'd actually been using the globals_asset_href keyword consistently in our design files. The links it generates are 'neater', e.g

href="%globals_asset_href:12345%" becomes: href="/science"

versus

href="./?a=12345" becomes: href="http://site.antarctica.gov.au/science"

We didn't really want to link to an asset that was under construction (the status was changed by mistake). However it made me think that if you had a 'public' page that linked to other pages with restricted permissions, then these links would probably be blank (rather than the more expected behaviour of taking you to the link destination and then showing a login box).

 

We can set our design files to use ./?a=xxx style links if necessary, I just wanted to check that there wasn't some other drawback to doing this.

 

Cheers,

 

Warwick


(Bart Banda) #6

I would still recommend using absolute paths as they seem to be recommended for SEO purposes. It can also be good for when you want to copy and paste a url of a link to someone. Plus when you print to something like PDF, the links would also work. We use absolute paths at Squiz as a best practice.