Thanks burningice! I still don't fully get how it works to be totally honest. I had no clue what the providerName should be or about the interfaceType because my generated datatype doesn't have an interface -- its a concrete type. However, with that said i was able to get it working with some educated guesses.
var a = new AssociatedDataElementProviderHelperEntityToken(TypeManager.SerializeType(typeof(IPage)), "PageElementProvider", page.Id.ToString(), TypeManager.SerializeType(typeof(Content.MyDataType)));
var permTypesNone = GetPermissionTypes(new UserPermissions() { PermissionTypes = new List<string>() { }, UserName = user.Username });
var perm = new ConstructorBasedUserPermissionDefinition(user.Username, permTypesNone, EntityTokenSerializer.Serialize(a));
PermissionTypeFacade.SetUserPermissionDefinition(perm);
Not sure if this is the "correct" way but it works so hopefully someone finds it useful
var a = new AssociatedDataElementProviderHelperEntityToken(TypeManager.SerializeType(typeof(IPage)), "PageElementProvider", page.Id.ToString(), TypeManager.SerializeType(typeof(Content.MyDataType)));
var permTypesNone = GetPermissionTypes(new UserPermissions() { PermissionTypes = new List<string>() { }, UserName = user.Username });
var perm = new ConstructorBasedUserPermissionDefinition(user.Username, permTypesNone, EntityTokenSerializer.Serialize(a));
PermissionTypeFacade.SetUserPermissionDefinition(perm);
Not sure if this is the "correct" way but it works so hopefully someone finds it useful