Hi there
I am new with Confluence ScriptRunner, and I'm a bit lost. I have to create a screen, when a user connects to Confluence, where he has to accept the Conditions of use.
I want to save the agreement as a user property, so I can later check who agreed and who didn't.
I couldn't find anything in Confluence about adding new properties/settings to the user.
Is there a way ? Did anybody do that ?
Thank you for your attention !
Pascal
So if some people are still interessted, the best solution is to use Bandana, that work with a context (could be global, a space key or a specific context for the properties you manage), a key (for me a string with the context name + user key + property version) and the value you want to store.
See Persistence in Confluence (atlassian.com) and What is Bandana? One form of Confluence persistence (atlassian.com)
Simple code:
import com.atlassian.bandana.BandanaManager
import com.atlassian.bandana.BandanaContext
import com.atlassian.confluence.setup.bandana.ConfluenceBandanaContext
String myContext = "<your context name>"
String myKey = "<your key>"
def myValue ="This could be text or a structure, an object ..."
ConfluenceBandanaContext ctx = new ConfluenceBandanaContext(myContext)
def bandanaManager = ComponentLocator.getomponent(BandanaManager)
// Store the value
bandanaManager.setValue(ctx, myKey, myValue);
//Retrieve the value
def myNewValue = bandanaManager.getValue(ctx, myKey)
but the data are anyway in the DB !
I don't get it ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.