Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,203
Community Members
 
Community Events
165
Community Groups

Concatenating the groupname and username columns in a Db query where groupname X is null

Edited

I'm trying to get a list of contentid's with the following criteria

 

Content ID has a view restriction and group X doesn't have access.

 

The issue is, when you try and slice this up, because groupname and usernames are in separate columns, if you just try and say 'where groupname != X', you don't get any rows of contentid's where the restrictions are purely based on usernames,

 

So after a lot of messing around, it looks like the easiest way would be to concatenate the two columns, name it something like restrictions and run a 'where' clause of 'restrictions not like X'

 

I started playing around with concactenations but one issue is you need to put the 'where' clause in a separate block, as you can't run where's on the initial concat query.

 

If you're wondering why, it's because if you dont parse out the Edit only pages, when I run my script to add the group with view perms, an edit only page with no view restrictions suddenly has them, learned this lesson on the production instance the hard way. thankfully it was reversable.

 

This is the skeleton I'm working with that needs the tweak

 

SELECT distinct c.contentid
FROM SPACES s, content c, content_perm_set cps, content_perm cp, content_perm_type
where
s.spaceid = c.spaceid and
c.contentid = cps.content_id and
cps.id = cp.cps_id and
c.contenttype = 'PAGE' and
c.prevver is null and
c.content_status = 'current' and
s.spacestatus = 'CURRENT' and

and content_perm_type = View
cp.groupname != '_confluence-browse-all';

 

any help would be appreciated.

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

380 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you