简体   繁体   English

如何使会员用户成为Ektron中的会员组管理员?

[英]How to make a membership user to the admin of a membership group in Ektron?

Am working with Ektron 9. 我正在与Ektron 9一起工作。

I have a situation ,where there are N membership groups there in Ektron. 我遇到的情况是,Ektron中有N个成员组。 I want to associate one membership user to each membership group ie If i have 4 Groups then there should be 4 admin , one admin for each group. 我想将一个成员资格用户关联到每个成员资格组,即如果我有4个组,那么应该有4个admin,每个组一个管理员。

The business scenario is i need to trigger an email to corresponding group admin when a new membership user registered with Ektron. 业务场景是,当新的会员用户向Ektron注册时,我需要触发一封电子邮件发送给相应的组管理员。

Is there any way to achieve this in Ektron? 有什么方法可以在Ektron中实现吗?

Thanks in advance. 提前致谢。

There isn't a concept of an "Admin" of a Membership group in Ektron. Ektron中没有成员资格组的“管理员”概念。 There is with a Community group, which might be what you're thinking about. 有一个社区组,这可能是您在考虑的问题。 In case that is, here's the documentation: 如果是这样,这里是文档:

http://documentation.ektron.com/cms400/v9.00/Reference/Web/EktronReferenceWeb.html#Communities/Managing_Community_Groups.htm http://documentation.ektron.com/cms400/v9.00/Reference/Web/EktronReferenceWeb.html#Communities/Managing_Community_Groups.htm

However, if you really do want to notify a Membership Group member, then you'll need to have a couple of things. 但是,如果您确实想通知成员资格组成员,则需要注意以下几点。

First, you would need a UserStrategy that employs the OnAfterUserAddInGroup (if you're also notifying on removal, then there's an OnAfterUserDeleteFromGroup). 首先,您将需要一个使用OnAfterUserAddInGroup的UserStrategy(如果您还要通知移除,则有一个OnAfterUserDeleteFromGroup)。 That will be where you kick off the code/app/whatever that sends the email. 那将是您启动发送电子邮件的代码/应用程序/的地方。 Strategies Documentation 策略文件

To identify which user is the "admin" will be tricky, however. 但是,识别哪个用户是“管理员”将很棘手。 As I said, there are no Admins for Member groups. 就像我说的那样,成员组没有管理员。 So you'll have to come up with your own way to assign that to someone. 因此,您必须想出自己的方式将其分配给某人。 You could use custom roles. 您可以使用自定义角色。 In that case, you would have a [GroupName] Admin role for each of your membership groups. 在这种情况下,您将为每个成员资格组具有[GroupName]管理员角色。 These could be created each time you create a group using a UserGroupStrategy OnAfterAddUserGroup (and rename the role using OnAfterUpdateUserGroup or OnBeforeUpdateUserGroup). 每当您使用UserGroupStrategy OnAfterAddUserGroup创建组(并使用OnAfterUpdateUserGroup或OnBeforeUpdateUserGroup重命名角色)时,都可以创建这些文件。 Roles Documentation 角色文档

Then you could assign one (or more) users to that role. 然后,您可以将一个(或多个)用户分配给该角色。 They wouldn't even necessarily need to be a member of the group. 他们甚至不一定需要成为该组的成员。 It could be a Membership or CMS user, etc. 它可能是会员或CMS用户等。

If you establish a Group Name = Role Name + " Admin" convention, then in the strategy you would simply need to find the role that follows that paradigm for the current group, get the users in that role, and send them an email. 如果您建立了“组名=角色名+“管理员”约定,那么在该策略中,您只需要找到当前组遵循该范式的角色,让该角色的用户获得并发送电子邮件。

It's a bit convoluted, but it would work and it would be mostly automated. 这有点令人费解,但是它可以工作并且大部分是自动化的。

Here is a commented sample that shows how to initialize the API, get all roles, check whether a user is a role member, add a new custom role, add a member to a role, and remove a member from a role. 以下是带有注释的示例,该示例显示了如何初始化API,获取所有角色,检查用户是否为角色成员,添加新的自定义角色,向角色添加成员以及从角色中删除成员。

var RoleAPI = new Ektron.Cms.API.Content.Content().EkContentRef;

// Get all custom roles (careful, as the first item in my test was null)
var roles = RoleAPI.GetAllRolePermissions();
// This will eliminate returned nulls.
var names = roles.Where(r => r != null).Select(r => r).ToArray();

// Check whether a user is a member of the role.
var isAMember = RoleAPI.IsARoleMember(1002, 10);

// Add a new custom role.
RoleAPI.AddRolePermission("Membership Group Admin");

// Add a user to a role.
var member = new RoleMemberData()
{
    MemberId = 10,
    // Even membership users are type = User.
    MemberType = RoleMemberData.RoleMemberType.User
};
RoleAPI.AddRoleMember(1002, ref member);

// Remove a user from a role (using member as defined above).
RoleAPI.DropRoleMember(1002, ref member);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM