当前位置: 首页>>代码示例>>C#>>正文


C# EntityToken.Equals方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:hitesh97,项目名称:C1-CMS,代码行数:39,代码来源:PermissionTypeFacade.cs

示例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);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:13,代码来源:ActionNode.cs

示例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;
        }
开发者ID:hitesh97,项目名称:C1-CMS,代码行数:56,代码来源:PermissionTypeFacade.cs

示例4: IsAttachmentPoint

 public override bool IsAttachmentPoint(EntityToken parentEntityToken)
 {
     return parentEntityToken.Equals(_parentEntityToken);
 }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:4,代码来源:CustomAttachmentPoint.cs


注:本文中的Composite.C1Console.Security.EntityToken.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。