Hey everyone,
We have a space in our Confluence instance that contains sensitive data that has specific rules around getting sent via e-mail. Since there isn't a good way to natively set watches for a specific Space/Page I'm looking into periodically removing watches programmatically.
I have a way to gather all URLs that have watches, including the page ID, I just need a way to use this information to remove all watches from them.
Here's the SQL to gather the URLs that contain watches in our Controlled space:
SELECT um.username,
CONCAT ('https://www.ourjira.com/wiki/pages/viewpage.action?pageId=', c.contentId) AS URL,
c.title,
s.spacename,
c.contentID
FROM NOTIFICATIONS n,
user_mapping um,
SPACES s,
CONTENT c
WHERE n.contenttype = 'page'
AND n.contentID = c.contentID
AND um.user_key = n.username
AND c.spaceID = s.spaceID
AND s.spacename = 'Controlled';
This results in a table similar to the following: