DbSessionManager
Methods
getSystemToken
Description:
Method | Return values | Description |
---|---|---|
getSystemToken() |
String |
Get the authorization token of the user system. |
There's a special super-user named system executed by OpenKM in the background. The authorization token of the user system is usually used to promote standard user's actions or cron jobs as a super-user.
|
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();
}
}
}