PrincipalUtils
Esta página aún no está disponible en tu idioma.
Utility methods for retrieving information from the security context. For example, get the actual userId from the security context session or get the actual tenant of the logged user.
Methods
Section titled “Methods”getUser
Section titled “getUser”Description:
| Method | Return values | Description |
|---|---|---|
| getUser() | String | Get the userId of the the logged user. |
Example:
package com.openkm;
package com.openkm.test;
import com.openkm.spring.PrincipalUtils;
public class Test { public static void main(String[] args) throws Exception { System.out.println(PrincipalUtils.getUser()); }}getTenantId
Section titled “getTenantId”Description:
| Method | Return values | Description |
|---|---|---|
| getTenantId() | long | Get the tenantId of the logged user. |
Example:
package com.openkm;
import com.openkm.spring.PrincipalUtils;
public class Test { public static void main(String[] args) throws Exception { long tenantId = PrincipalUtils.getTenantId(); System.out.println(tenantId); }}