Write restrictions from user defined function

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

@Context
public Transaction tx;

@UserFunction
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:

Neo.ClientError.Security.Forbidden
'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.