Sitecore 外联网管理员?

发布于 10-27 15:48 字数 222 浏览 9 评论 0原文

你好 我正在开发一个具有多个站点的应用程序,每个站点都有自己的外联网,使用 Sitecore 6.4,这一切都工作得很好。

现在我需要每个站点的编辑(而不是管理员)能够创建只能访问连接到该站点的 Extranet 的 Extranet 用户,这可能吗?

基本上我正在寻找这样的结构:

Sitecore\Editor(本地外联网管理员)

Extranet\user

Hi
I am devolping an application with multiple sites and each site has their own extranet, and this is all working beautifully, using Sitecore 6.4.

Now I need the editors (not admins) of each site to be able to create extranet users that is only able to access the extranet connected to the site, is this even possible?

Basically I am looking for at structure like this:

Sitecore\Editor (Local extranet admin)

Extranet\user

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一桥轻雨一伞开2024-11-03 15:48:11

我认为您可以为每个“外联网”创建一个外联网角色,例如。站点 1 管理员。

然后创建一个页面,使他们能够创建用户,为该用户提供所需的基本角色。

这是 Sitecore 6.0 的代码,尽管它应该与 6.4 相同,据我所知:

Sitecore.Security.Accounts.User user;
if (!Sitecore.Context.IsLoggedIn)
{
    string domainUser = Sitecore.Context.Domain.GetFullName("youruser");
    string txtPassword = "yourpass";
    string txtEmail = "youremail";

    if (Sitecore.Security.Accounts.User.Exists(domainUser))
        return;

    MembershipCreateStatus status;
    Membership.CreateUser(domainUser, txtPassword, txtEmail, "Never?", "Always!", true, out status);

    if (!status.Equals(MembershipCreateStatus.Success))
    {
        throw new MembershipCreateUserException(status.ToString());
    }       
    user = //something to load the user, probably in Sitecore.Security.Accounts.User
}
    var role = "extranet\\Site1User";   

    var roles = Roles.GetRolesForUser(); //this is probably only for the current context user
    if (!roles.Contains(role))
    {
        try
        {
            Roles.AddUsersToRole(new string[] { "youruser" }, role);
        }
        catch(System.Configuration.Provider.ProviderException)
        {
            // do nothing, just move on
        }

    }
}

这有点简单,基于我尝试从一些工作代码中组合在一起的一些代码,该代码创建了一个用户并让他登录,应该调整为你正在做什么,因为可能存在一些错误。

I would think you could make an Extranet Role for each of you "extranets", eg. Site1Admin.

And then make a page that enables them to create a user, giving that user the basic roles it needs.

This is code for Sitecore 6.0, though it should be the same for 6.4 afaik:

Sitecore.Security.Accounts.User user;
if (!Sitecore.Context.IsLoggedIn)
{
    string domainUser = Sitecore.Context.Domain.GetFullName("youruser");
    string txtPassword = "yourpass";
    string txtEmail = "youremail";

    if (Sitecore.Security.Accounts.User.Exists(domainUser))
        return;

    MembershipCreateStatus status;
    Membership.CreateUser(domainUser, txtPassword, txtEmail, "Never?", "Always!", true, out status);

    if (!status.Equals(MembershipCreateStatus.Success))
    {
        throw new MembershipCreateUserException(status.ToString());
    }       
    user = //something to load the user, probably in Sitecore.Security.Accounts.User
}
    var role = "extranet\\Site1User";   

    var roles = Roles.GetRolesForUser(); //this is probably only for the current context user
    if (!roles.Contains(role))
    {
        try
        {
            Roles.AddUsersToRole(new string[] { "youruser" }, role);
        }
        catch(System.Configuration.Provider.ProviderException)
        {
            // do nothing, just move on
        }

    }
}

This is kinda simple, is based on some code I tried to hack together from some working code, that created a user and logged him in and should be adjusted to what you are doing, as there are probably some errors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文