首页 文章

具有权限和角色角色的Sitecore活动目录问题

提问于
浏览
5

问题

我编写了自定义成员资格/角色/配置文件提供程序,以根据Active Directory域对用户进行身份验证 . 我正在尝试使用角色中的角色,通过将其AD组添加为相应的sitecore角色的成员,在ADDOMAIN中为其提供sitecore权限 . 如果我以AD用户身份登录,我似乎没有sitecore角色的权限,但是,如果我以相同的sitecore角色作为sitecore用户登录,我会获得权限 . 我需要在会员/角色提供者中缺少哪些内容才能使这项工作或在这里发挥其他作用?

我们正在使用Sitecore版本6.4,如果这有任何区别 .

SOLUTION :@Yan的答案彻底解决了这个问题 . 问题是语言权限仅明确授予sitecore域用户(通过sitecore \ Everyone) . 创建AD用户时,它们位于不同的域中,不会继承这些语言权限 . 修复方法是专门为AD域授予读/写权限,或者像我一样,创建另一个sitecore角色并为该角色分配必要的权限,然后将我的AD角色分配给该角色 .

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

更多细节

我提前为详细程度道歉 .

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

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

如果令人困惑,这里是一个直观的表示:

Sitecore Roles

    sitecore\Content Author
      - sitecore\bcauthor
      - ADDOMAIN\Web-Authors-Group
      - sitecore\SecondAuthorRole
    sitecore\SecondAuthorRole
      - sitecore\secondAuthor

ActiveDirectory Groups

    ADDOMAIN\Web-Authors-Group
      - 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)
}

Profiles 提供者

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)
}

1 回答

  • 8

    老实说,我没有阅读整篇文章,只是它的“问题”部分 . 我怀疑我知道问题是什么 . 它与语言有关:读取和语言:写入权限 .

    看看我上一篇文章到this SDN forum thread . 请务必使用图像检查附加的存档,以便更好地理解 .

相关问题