Write restrictions from user defined function

I wrote a user defined function, which basically looks like this:

public Transaction tx;

public Node createNode(@Name("labelName") String name) {		
	Node newNode = tx.createNode(Label.label(name));
    return newNode;

After compiling to jar file, deploying it and running the createNode-function in the browser of Neo4j Desktop I get the following error:

'create_label' operations are not allowed for user 'neo4j' with roles [admin] restricted to READ.

When I create a new node through Cypher it all works fine. Should i change my settings somewhere?

User defined function are not allowed to perform any writes. You have to use a stored procedure instead.