【问题标题】:Sitecore active directory problem with permissions and roles-in-rolesSitecore Active Directory 权限和角色中的角色问题
【发布时间】:2011-07-26 14:32:03
【问题描述】:

问题

我编写了自定义成员资格/角色/个人资料提供程序,以根据 Active Directory 域对用户进行身份验证。我正在尝试使用角色中的角色为 ADDOMAIN 中的用户提供站点核心权限,方法是将他们的 AD 组添加为适当的站点核心角色的成员。如果我以 AD 用户身份登录,我似乎没有 sitecore 角色的权限,但是,如果我以同一 sitecore 角色的 sitecore 用户身份登录,我确实获得了权限。我需要在成员资格/角色提供者中包含哪些东西才能使这项工作发挥作用,或者这里还有其他东西在起作用吗?

如果这有什么不同的话,我们使用的是 Sitecore 6.4 版。

解决方案:@Yan 的回答完全解决了这个问题。问题是语言权限仅明确授予 sitecore 域用户(通过 sitecore\Everyone)。创建 AD 用户时,他们位于不同的域中并且不继承这些语言权限。解决方法是专门向 AD 域授予读/写权限,或者像我所做的那样,创建另一个站点核心角色并将必要的权限分配给该角色,然后将我的 AD 角色分配给该角色。

您需要在 /System/Languages/[LANGUAGE: en in my case] 项的 master 数据库中设置 lang:read 和 lang:write 权限。如果您在安全编辑器中看不到这些权限,请单击列按钮并选择这些列。

更多详情

对于详细程度,我提前道歉。

我编写了自定义成员资格/角色/个人资料提供程序,以根据 Active Directory 域对用户进行身份验证。我们没有使用 sitecore 提供的 AD 模块,因为我们只希望我们的用户看到特定的组和用户,而不是 AD 中的每个用户/组。我也只是尝试提供身份验证和角色成员资格服务,因为我不希望站点核心管理员能够修改 AD 用户或角色。

我正在测试的角色称为 sitecore\Content Author,因为它具有我希望我的 AD 用户拥有的权限。 AD 用户是 AD 和 sitecore 内 ADDOMAIN\Web-Authors-Group 组的一部分,我已将此组设置为属于 sitecore\Content Author。用户 ADDOMAIN\sitecoreauthor1 是 AD 中 ADDOMAIN\Web-Authors-Group 的成员,我还有一个 sitecore 用户 sitecore\bcauthor 用户谁是 sitecore\Content Author 角色的成员。我还设置了一个名为 sitecore\SecondAuthorRole 的单独站点核心角色和该角色中的用户 sitecore\secondAuthor,以测试角色角色功能是否正常工作。

如果这令人困惑,这里有一个视觉表示:

Sitecore 角色 sitecore\内容作者 - 网站核心\bcauthor - ADDOMAIN\Web-Authors-Group -sitecore\SecondAuthorRole sitecore\SecondAuthorRole -sitecore\secondAuthor 活动目录组 ADDOMAIN\Web-作者-组 - ADDOMAIN\sitecoreauthor1

如果我以 sitecore\bcauthor 身份登录,我可以做 sitecore\Content Author 角色可以做的所有事情。如果我以 sitecore\secondAuthor 身份登录,我还可以做 sitecore\Content Author 角色可以做的所有事情。但是,如果我以 ADDOMAIN\sitecoreauthor1 用户身份登录,我似乎没有任何 sitecore\Content Author 角色的权限。

更多信息

主页项目(我正在测试的项目)的权限是:

 ar|sitecore\Content Author|pe|+item:rename|+item:write|+item:delete|+item:create|pd|+item:rename|+item:write|+item:delete|+item:create

代码

以下是实现成员资格、角色和配置文件的只读提供程序的类的框架:

会员提供者类

public class DirectoryMembershipProvider : System.Web.Security.MembershipProvider
{
    public override string ApplicationName { get; set; }
    public override bool EnablePasswordReset { get { return false; } }
    public override bool EnablePasswordRetrieval { get { return false; } }
    public override int MaxInvalidPasswordAttempts { get { return 100; } }
    public override int MinRequiredNonAlphanumericCharacters { get { return 0; } }
    public override int MinRequiredPasswordLength { get { return 1; } }
    public override MembershipPasswordFormat PasswordFormat { get { return MembershipPasswordFormat.Clear; } }
    public override string PasswordStrengthRegularExpression { get { return ""; } }
    public override bool RequiresQuestionAndAnswer { get { return false; } }
    public override bool RequiresUniqueEmail { get { return false; } }

    // Not implemented
    public override bool ChangePassword(string username, string oldPassword, string newPassword)
    public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
    public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
    protected override byte[] DecryptPassword(byte[] encodedPassword)
    public override bool DeleteUser(string username, bool deleteAllRelatedData)
    protected override byte[] EncryptPassword(byte[] password)
    protected override byte[] EncryptPassword(byte[] password, MembershipPasswordCompatibilityMode legacyPasswordCompatibilityMode)
    protected override void OnValidatingPassword(ValidatePasswordEventArgs e)
    public override string ResetPassword(string username, string answer)
    public override bool UnlockUser(string userName)
    public override void UpdateUser(MembershipUser user)

    // Implemented functions
    public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
    public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
    public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
    public override string GetPassword(string username, string answer)
    public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
    public override MembershipUser GetUser(string username, bool userIsOnline)
    public override string GetUserNameByEmail(string email)
    public override bool ValidateUser(string username, string password)
}

角色提供者

public class DirectoryRoleProvider : System.Web.Security.RoleProvider
{
    public override string ApplicationName { get; set; }

    // not implemented
    public override void AddUsersToRoles(string[] usernames, string[] roleNames)
    public override void CreateRole(string roleName)
    public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
    public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)

    // implemented functions
    public override string[] FindUsersInRole(string roleName, string usernameToMatch)
    public override string[] GetAllRoles()
    public override string[] GetRolesForUser(string username)
    public override string[] GetUsersInRole(string roleName)
    public override bool IsUserInRole(string username, string roleName)
    public override bool RoleExists(string roleName)
}

配置文件提供者

public class DirectoryProfileProvider : System.Web.Profile.ProfileProvider
{
    public override string ApplicationName { get; set; }

    public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate) { return 0; }
    public override int DeleteProfiles(ProfileInfoCollection profiles) { return 0; }
    public override int DeleteProfiles(string[] usernames) { return 0; }

    // not implemented
    public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
    public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)

    // implemented functions
    public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
    public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
    public override int GetNumberOfInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
    public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection collection)
    public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection)
}

【问题讨论】:

    标签: permissions active-directory roles sitecore sitecore6


    【解决方案1】:

    老实说,我没有阅读全文,只是阅读了其中的“问题”部分。我怀疑我知道问题出在哪里。它与 Language:Read 和 Language:Write 权限有关。

    看看我上一篇发给this SDN forum thread的帖子。请务必查看随附的带有图片的存档,以便更好地理解。

    【讨论】:

    • 伙计,你是个奇迹创造者!谢谢,这已经困扰我一个多星期了。我将尝试编辑问题以包含您的答案,这样人们就不必去 SDN 论坛,并且可以直接从 stackoverflow 获得答案
    • 很想支持这个答案,但我在 stackoverflow 中还没有足够的代表。
    • 很高兴知道问题已解决。这也证明我的直觉还是不错的;-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-02
    • 1970-01-01
    • 1970-01-01
    • 2021-01-03
    • 1970-01-01
    • 2014-06-16
    • 1970-01-01
    相关资源
    最近更新 更多