sharepoint 中的匿名目标受众
到目前为止,我在 sharepoint 中遇到的最大问题是,如果用户未登录,能够使某个 Web 部件不可见或隐藏,基本上是能够为匿名用户建立受众。 如果有人知道该怎么做,请帮忙。
The biggest problem I have faced so far in sharepoint, is to be able to make a certain webparts invisible or hide if the user is not logged in, basically to be able to make an audience for anonymous user.
If anyone knows how to do that, please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,开箱即用的唯一方法是将整个 Web 部件区域包装在 SPSecurityTrimmedControl 中。
您可以尝试的另一件事是为每个 Web 部件类型创建控制适配器,然后在其中实现显示逻辑。但请注意,这种方法有一些局限性。最重要的是,所有控制适配器都将应用于给定类型的给定 Web 应用程序中的每个 Web 部件。
As far as I know the only way to do that out of the box is to wrap the complete Web Part Zone in a SPSecurityTrimmedControl.
Another thing you could try is to create Control Adapter for every single Web Part type and then implement the display logic in there. Please notice though, that this approach has some limitations. The most important is that all Control Adapters will be applied to every single Web Part in the given Web Application of the given type.
我使用的一个小技巧是隐藏 CSS 中的 Web 部件(主 CSS 或其他 Web 部件),然后使用另一个 Web 部件(这次针对经过身份验证的用户)覆盖初始 CSS,使内容可见。我不建议将其用于安全内容,因为 Web 部件仍在客户端呈现,但如果您要使用 UI 元素,则这非常有效。
A little trick I use is to hide the web part in your CSS (either your master CSS or another web part), and then use ANOTHER web part - this time targeted to authenticated users - that overrides the initial CSS, making the content visible. I wouldn't recommend it for secure content, since the web part is still being rendered at the client, but if you're going for UI elements, this works perfectly.