本文整理汇总了C#中Composite.C1Console.Security.EntityToken.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# EntityToken.Equals方法的具体用法?C# EntityToken.Equals怎么用?C# EntityToken.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composite.C1Console.Security.EntityToken
的用法示例。
在下文中一共展示了EntityToken.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInheritedGroupPermissionsTypesRecursivly
private static IEnumerable<PermissionType> GetInheritedGroupPermissionsTypesRecursivly(EntityToken entityToken, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions, List<EntityToken> visitedParents = null)
{
UserGroupPermissionDefinition selectedUserGroupPermissionDefinition = userGroupPermissionDefinitions.Where(f => entityToken.Equals(f.EntityToken)).SingleOrDefault();
if (selectedUserGroupPermissionDefinition != null)
{
if (selectedUserGroupPermissionDefinition.PermissionTypes.Contains(PermissionType.ClearPermissions) == false)
{
foreach (PermissionType permissionType in selectedUserGroupPermissionDefinition.PermissionTypes)
{
yield return permissionType;
}
}
yield break;
}
List<EntityToken> parentEntityTokens = ParentsFacade.GetAllParents(entityToken);
if (visitedParents == null)
{
visitedParents = new List<EntityToken>();
}
IEnumerable<PermissionType> parentsPermisstionTypes = new List<PermissionType>();
foreach (EntityToken parentEntityToken in parentEntityTokens)
{
if (visitedParents.Contains(parentEntityToken)) continue;
visitedParents.Add(parentEntityToken);
IEnumerable<PermissionType> result = GetInheritedGroupPermissionsTypesRecursivly(parentEntityToken, userGroupPermissionDefinitions, visitedParents).ToList();
parentsPermisstionTypes = parentsPermisstionTypes.Concat(result);
}
foreach (PermissionType permissionType in parentsPermisstionTypes.Distinct())
{
yield return permissionType;
}
}
示例2: AddAction
/// <exclude />
public void AddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext)
{
var piggybag = dynamicContext.Piggybag;
if (!entityToken.Equals(dynamicContext.CurrentEntityToken))
{
piggybag = piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken);
}
var replaceContext = new DynamicValuesHelperReplaceContext(entityToken, piggybag);
OnAddAction(actionAdder, entityToken, dynamicContext, replaceContext);
}
示例3: RecursiveUpdateCurrentUserGroupPermissionTypes
private static IReadOnlyCollection<PermissionType> RecursiveUpdateCurrentUserGroupPermissionTypes(UserToken userToken, EntityToken entityToken, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions, HashSet<EntityTokenPair> alreadyProcessedTokens)
{
IReadOnlyCollection<PermissionType> cached = PermissionTypeFacadeCaching.GetUserGroupPermissionTypes(userToken, entityToken);
if (cached != null)
{
return cached;
}
IEnumerable<UserGroupPermissionDefinition> selectedUserGroupPermissionDefinitions = userGroupPermissionDefinitions.Where(f => entityToken.Equals(f.EntityToken));
List<PermissionType> thisPermisstionTypes = new List<PermissionType>();
foreach (UserGroupPermissionDefinition userGroupPermissionDefinition in selectedUserGroupPermissionDefinitions)
{
List<PermissionType> groupPermissionTypes = userGroupPermissionDefinition.PermissionTypes.ToList();
thisPermisstionTypes.AddRange(groupPermissionTypes);
}
if (thisPermisstionTypes.Count > 0)
{
thisPermisstionTypes = thisPermisstionTypes.Distinct().ToList();
if (thisPermisstionTypes.Contains(PermissionType.ClearPermissions))
{
thisPermisstionTypes = new List<PermissionType>();
}
PermissionTypeFacadeCaching.SetUserGroupPermissionTypes(userToken, entityToken, thisPermisstionTypes);
// Local defined permission overrules all other permissions
return thisPermisstionTypes;
}
// Call resursively on all parents
List<EntityToken> parentEntityTokens = ParentsFacade.GetAllParents(entityToken);
IEnumerable<PermissionType> parentsPermisstionTypes = new List<PermissionType>();
foreach (EntityToken parentEntityToken in parentEntityTokens)
{
EntityTokenPair pair = new EntityTokenPair(entityToken, parentEntityToken);
if (alreadyProcessedTokens.Contains(pair) == false)
{
alreadyProcessedTokens.Add(pair);
IEnumerable<PermissionType> thisParentPermisstionTypes = RecursiveUpdateCurrentUserGroupPermissionTypes(userToken, parentEntityToken, userGroupPermissionDefinitions, alreadyProcessedTokens);
parentsPermisstionTypes = parentsPermisstionTypes.Concat(thisParentPermisstionTypes);
}
}
List<PermissionType> permisstionTypes = parentsPermisstionTypes.Distinct().ToList();
PermissionTypeFacadeCaching.SetUserGroupPermissionTypes(userToken, entityToken, permisstionTypes);
return permisstionTypes;
}
示例4: IsAttachmentPoint
public override bool IsAttachmentPoint(EntityToken parentEntityToken)
{
return parentEntityToken.Equals(_parentEntityToken);
}