DbSessionManager

Methods

getSystemToken

Description:

MethodReturn valuesDescription

getSystemToken()

String

Gets the authorization token for the system user.

There is a special super-user named system, executed by OpenKM in the background.

The authorization token of the system user is usually used to promote standard user actions or cron jobs to super-user privileges.

Example:

package com.openkm;

import com.openkm.api.OKMDocument;
import com.openkm.module.db.stuff.DbSessionManager;
import com.openkm.util.ContextWrapper;

public class Test {

    public static void main(String[] args) {
        try {
            OKMDocument okmDocument = ContextWrapper.getContext().getBean(OKMDocument.class);
            String systemToken = DbSessionManager.getInstance().getSystemToken();
            okmDocument.delete(systemToken, "d50133e3-dbfa-4d01-a109-28785cd48f40"); // Delete action is executed by user system because systemToken
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Table of contents [ Hide Show ]