我正在尝试使用
获取在露天用户的用户名String name = serviceRegistry.getAuthenticationService().getCurrentUser();
但无论登录哪个用户,它都会返回管理员。
然后我试了
String name = AuthenticationUtil.getFullyAuthenticatedUser();
它还会为所有用户返回admin。
我用Google搜索没有任何成功。这是露天的错误还是我需要照顾别的东西才能得到合适的用户名?
或者还有其他方法可以获取当前登录的用户名吗?
答案 0 :(得分:4)
String name = AuthenticationUtil.getFullyAuthenticatedUser();
是获取当前用户的userName的正确方法。
每个webscript都有一个描述符,您可以在其中配置执行webscript所需的身份验证:http://docs.alfresco.com/4.2/references/api-wsdl-authentication.html
通常,您将使用<authentication>user</authentication>
露天仓库中有两个不同的'runtimes'可用于执行webscript: