Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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
Community Members
Community Events
Community Groups

ContentPermissionEvent: Telling add/remove events apart

I'd like to record permission changes on pages. I already found this but figured I might be able to implement something myself with the help of the Scriptrunner Addon.

I created a custom Event which listens to the ContentPermissionEvent being fired. Generally speaking it would be enough to log something to console stating how a permission was changed. I also found out that the confluence database keeps the set of page permissions, whereas no entry means "full permissions and EDIT/VIEW are written according to what I configured.

The following shows the script that I got so far.

import com.atlassian.confluence.core.ContentEntityObject
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.user.User

// create Loglistener
def log = Logger.getLogger("")


def event = event as ContentPermissionEvent
def contentid = event.content.idAsString
def contentPermission = event.contentPermission

def permissionString

//group our user
permissionString = "Group: " + contentPermission.groupName
permissionString = "User: " + contentPermission.userName

permissionString = permissionString + ", Type: " + contentPermission.type

// Log data from Event"PermissionEvent registered for PageId " + contentid + ", details: " + permissionString)


Apparently the event seems to be not smart enough to tell adding and removing permissions apart. In both cases the log entry is the same. Is there a way to tell them apart?

Thanks allot for any pointers.

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events