I am in the middle of converting the obsolete INodePermissions to use the IPermissions.
Below is my code that I have a question on. The "PermissionCheckOptions" object has contents and applications, but not the container.. that doesn't seem right to me as far as the permission checks are concerned.
maybe it is... I think it works.
using Telligent.Evolution.Extensibility.Urls.Version1; using Telligent.Evolution.Extensibility.Api.Entities.Version1; using TEApis = Telligent.Evolution.Extensibility.Apis; using TEApiV1 = Telligent.Evolution.Extensibility.Api.Version1; using TEApiV2 = Telligent.Evolution.Extensibility.Api.Version2; ... // Group Container Type Guid containerTypeId = TEApis.Get<TEApiV1.IGroups>().ContainerTypeId; // Type the groupItem and cast as ContextItem ContextItem groupItem = (ContextItem) pageContext.ContextItems.Find(i => i.ContentTypeId == containerTypeId); // cast groupItem Guid? to a Guid Guid containerId = (Guid)groupItem.ContainerId; // Get the accessing user int accessing_userId = TEApis.Get<TEApiV1.IUsers>().AccessingUser.Id.Value; // Get the ModifyGroup Permission Guid Guid Group_ModifyGroup_PermissionId = TEApis.Get<TEApiV1.IGroupPermissions>().ModifyGroup; // Initializ the Permission Check Option object TEApiV2.PermissionCheckOptions permissionCheckOptions = new TEApiV2.PermissionCheckOptions(); // This is not intutive, as there is only Content and Applications. // So, we must use the Application, based on the group container. permissionCheckOptions.ApplicationId = containerId; permissionCheckOptions.ApplicationTypeId = containerTypeId; // finally, check the permissions PermissionCheck modifyGroup = TEApis.Get<TEApiV2.IPermissions>().CheckPermission(Group_ModifyGroup_PermissionId, accessing_userId, permissionCheckOptions);