简体   繁体   中英

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

Am working with Ektron 9.

I have a situation ,where there are N membership groups there in Ektron. 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.

The business scenario is i need to trigger an email to corresponding group admin when a new membership user registered with Ektron.

Is there any way to achieve this in Ektron?

Thanks in advance.

There isn't a concept of an "Admin" of a Membership group in 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

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). 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. These could be created each time you create a group using a UserGroupStrategy OnAfterAddUserGroup (and rename the role using OnAfterUpdateUserGroup or 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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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