本文整理汇总了C#中Composite.C1Console.Security.EntityToken.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# EntityToken.GetType方法的具体用法?C# EntityToken.GetType怎么用?C# EntityToken.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composite.C1Console.Security.EntityToken
的用法示例。
在下文中一共展示了EntityToken.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsAttachingPoint
/// <exclude />
public static bool IsAttachingPoint(EntityToken leftEntityToken, EntityToken rightEntityToken)
{
return leftEntityToken.GetType() == rightEntityToken.GetType()
&& leftEntityToken.Id == rightEntityToken.Id
&& leftEntityToken.Type == rightEntityToken.Type
&& leftEntityToken.Source == rightEntityToken.Source;
}
示例2: GetParents
public IEnumerable<EntityToken> GetParents(EntityToken entityToken)
{
if (entityToken == null) throw new ArgumentNullException("entityToken");
List<IAuxiliarySecurityAncestorProvider> auxiliarySecurityAncestorProviders;
List<IAuxiliarySecurityAncestorProvider> flushPersistentAuxiliarySecurityAncestorProviders;
_auxiliarySecurityAncestorProviders.TryGetValue(entityToken.GetType(), out auxiliarySecurityAncestorProviders);
_flushPersistentAuxiliarySecurityAncestorProviders.TryGetValue(entityToken.GetType(), out flushPersistentAuxiliarySecurityAncestorProviders);
IEnumerable<IAuxiliarySecurityAncestorProvider> resultSecurityAncestorProviders = auxiliarySecurityAncestorProviders.ConcatOrDefault(flushPersistentAuxiliarySecurityAncestorProviders);
if (resultSecurityAncestorProviders == null) return null;
IEnumerable<EntityToken> totalResult = null;
foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in resultSecurityAncestorProviders)
{
Dictionary<EntityToken, IEnumerable<EntityToken>> result = auxiliarySecurityAncestorProvider.GetParents(new EntityToken[] { entityToken });
if (result.Count > 0)
{
var firstValue = result.Values.First();
if (totalResult == null)
{
totalResult = firstValue;
}
else
{
totalResult = totalResult.Concat(firstValue);
}
}
}
return totalResult;
}
示例3: PostRefreshMessages
/// <exclude />
public void PostRefreshMessages(EntityToken specificEntityToken)
{
Verify.ArgumentNotNull(specificEntityToken, "specificEntityToken");
if (_postRefreshMessagesCalled)
{
throw new InvalidOperationException("Only one PostRefreshMessages call is allowed");
}
IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
messageService.RefreshTreeSection(specificEntityToken);
Log.LogVerbose(GetType().Name, "Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}", specificEntityToken.Type, specificEntityToken.Source, specificEntityToken.Id, specificEntityToken.GetType());
}
示例4: GetChildren
public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
{
if ((entityToken is PackageElementProviderRootEntityToken))
{
return GetRootChildren(seachToken);
}
if ((entityToken is PackageElementProviderAvailablePackagesFolderEntityToken))
{
return GetAvailablePackagesFolderChildren(seachToken);
}
if ((entityToken is PackageElementProviderAvailablePackagesGroupFolderEntityToken))
{
var castedToken = entityToken as PackageElementProviderAvailablePackagesGroupFolderEntityToken;
return GetAvailablePackageGroupFolderChildren(castedToken.GroupName, seachToken);
}
if ((entityToken is PackageElementProviderInstalledPackageFolderEntityToken))
{
return GetInstalledPackageFolderChildren(seachToken);
}
if ((entityToken is PackageElementProviderPackageSourcesFolderEntityToken))
{
return GetPackageSourcesFolderChildren(seachToken);
}
if ((entityToken is PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken))
{
return GetInstalledLocalPackagesFolderChildren(seachToken);
}
if ((entityToken is PackageElementProviderInstalledPackageGroupFolderEntityToken))
{
var castedToken = entityToken as PackageElementProviderInstalledPackageGroupFolderEntityToken;
return GetInstalledPackageGroupFolderChildren(castedToken.GroupName, seachToken);
}
throw new InvalidOperationException("Unexpected entity token type: " + entityToken.GetType());
}
示例5: PrettyPrintEntityToken
//.........这里部分代码省略.........
IEnumerable<PermissionType> currentPermissionTypes = PermissionTypeFacade.GetCurrentPermissionTypes(new UserToken(username), entityToken, PermissionTypeFacade.GetUserPermissionDefinitions(username), PermissionTypeFacade.GetUserGroupPermissionDefinitions(username));
StringBuilder currentSb = new StringBuilder();
foreach (PermissionType permissionType in currentPermissionTypes)
{
if (currentSb.ToString() != "")
{
currentSb.Append(", ");
}
currentSb.Append(new PermissionDescriptor(permissionType).Label);
}
currentUsersPermisstionTypes.Add(new XElement("span", new XAttribute("style", "padding-left: 15px;"), string.Format("{0} = {1}", username, currentSb.ToString())));
currentUsersPermisstionTypes.Add(new XElement("br"));
}
List<object> userGroupPermissionsDefinedHere = new List<object>();
List<object> inheritedGroupPermissions = new List<object>();
List<IUserGroup> userGroups = DataFacade.GetData<IUserGroup>().ToList();
foreach (IUserGroup userGroup in userGroups)
{
IEnumerable<PermissionType> userGroupPermissionTypes = PermissionTypeFacade.GetLocallyDefinedUserGroupPermissionTypes(userGroup.Id, entityToken);
StringBuilder sb = new StringBuilder();
foreach (PermissionType permissionType in userGroupPermissionTypes)
{
if (sb.ToString() != "")
{
sb.Append(", ");
}
sb.Append(new PermissionDescriptor(permissionType).Label);
}
userGroupPermissionsDefinedHere.Add(new XElement("span", new XAttribute("style", "padding-left: 15px;"), string.Format("{0} = {1}", userGroup.Name, sb.ToString())));
userGroupPermissionsDefinedHere.Add(new XElement("br"));
IEnumerable<PermissionType> inheritedUserGroupPermissionTypes = PermissionTypeFacade.GetInheritedGroupPermissionsTypes(userGroup.Id, entityToken);
sb = new StringBuilder();
foreach (PermissionType permissionType in inheritedUserGroupPermissionTypes)
{
if (sb.ToString() != "")
{
sb.Append(", ");
}
sb.Append(new PermissionDescriptor(permissionType).Label);
}
inheritedGroupPermissions.Add(new XElement("span", new XAttribute("style", "padding-left: 15px;"), string.Format("{0} = {1}", userGroup.Name, sb.ToString())));
inheritedGroupPermissions.Add(new XElement("br"));
}
XElement element =
new XElement("div", new XAttribute("style", string.Format("border:2px; border-style: solid; border-color: {0}; margin-bottom: 2px; margin-left:5px; margin-right:5px; padding: 3px;", color)),
new XElement("b", "Runtime type: "),
entityToken.GetType().ToString(),
new XElement("br"),
new XElement("b", "Hashcode: "),
entityToken.GetHashCode().ToString(),
new XElement("br"),
new XElement("b", "Source: "),
entityToken.Source,
new XElement("br"),
new XElement("b", "Type: "),
entityToken.Type,
new XElement("br"),
new XElement("b", "Id: "),
idList,
new XElement("br"),
new XElement("b", "Serialized entity token: "),
serializedEntityToken,
new XElement("br"),
new XElement("b", "Users permissions defined here: "),
new XElement("br"),
usersermisstionsDefinedHere,
new XElement("br"),
new XElement("b", "Current users permissions here: "),
new XElement("br"),
currentUsersPermisstionTypes,
new XElement("br"),
new XElement("b", "User group permissions defined here: "),
new XElement("br"),
userGroupPermissionsDefinedHere,
new XElement("br"),
new XElement("b", "Inherted user group permissions: "),
new XElement("br"),
inheritedGroupPermissions,
new XElement("br")
);
RelationshipGraphHolder.Controls.Add(new LiteralControl(element.ToString()));
}
示例6: GetPageTemplateDeleter
private ITemplateDeleter GetPageTemplateDeleter(EntityToken entityToken)
{
if (entityToken is DataEntityToken)
{
return new XmlPageTemplateDeleter(entityToken as DataEntityToken);
}
if(entityToken is PageTemplateEntityToken)
{
Guid pageTemplateId = (entityToken as PageTemplateEntityToken).TemplateId;
var pageTemplateDescriptor = PageTemplateFacade.GetPageTemplate(pageTemplateId);
if(pageTemplateDescriptor is RazorPageTemplateDescriptor)
{
return new RazorPageTemplateDeleter(pageTemplateDescriptor as RazorPageTemplateDescriptor);
}
if(pageTemplateDescriptor is MasterPagePageTemplateDescriptor)
{
return new MasterPagePageTemplateDeleter(pageTemplateDescriptor as MasterPagePageTemplateDescriptor);
}
throw new NotSupportedException("Not supported page template descriptor type '{0}'"
.FormatWith(pageTemplateDescriptor.GetType().FullName));
}
throw new NotSupportedException("Not supported entity token type '{0}'".FormatWith(entityToken.GetType().FullName));
}
示例7: Execute
/// <exclude />
public static FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer, TaskManagerEvent taskManagerEvent)
{
if (entityToken == null) throw new ArgumentNullException("entityToken");
if (actionToken == null) throw new ArgumentNullException("actionToken");
string username = UserValidationFacade.GetUsername();
#if NO_SECURITY
#else
HookingFacade.EnsureInitialization();
IEnumerable<UserPermissionDefinition> userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(username);
IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(username);
SecurityResult securityResult = SecurityResolver.Resolve(UserValidationFacade.GetUserToken(), actionToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinitions);
if ((securityResult != SecurityResult.Allowed) && (entityToken.GetType() != typeof(SecurityViolationWorkflowEntityToken)))
{
return ExecuteSecurityViolation(actionToken, entityToken, flowControllerServicesContainer);
}
#endif
bool ignoreLocking = actionToken.IsIgnoreEntityTokenLocking();
if ((ignoreLocking) ||
(ActionLockingFacade.IsLocked(entityToken) == false))
{
IActionExecutor actionExecutor = ActionExecutorCache.GetActionExecutor(actionToken);
ActionEventSystemFacade.FireOnBeforeActionExecution(entityToken, actionToken);
FlowToken flowToken;
using (TaskContainer taskContainer = TaskManagerFacade.CreateNewTasks(entityToken, actionToken, taskManagerEvent))
{
ITaskManagerFlowControllerService taskManagerService = null;
if (flowControllerServicesContainer.GetService(typeof(ITaskManagerFlowControllerService)) == null)
{
taskManagerService = new TaskManagerFlowControllerService(taskContainer);
flowControllerServicesContainer.AddService(taskManagerService);
}
try
{
if ((actionExecutor is IActionExecutorSerializedParameters))
{
string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);
string serializedActionToken = ActionTokenSerializer.Serialize(actionToken);
flowToken = Execute(actionExecutor as IActionExecutorSerializedParameters,
serializedEntityToken, serializedActionToken, actionToken,
flowControllerServicesContainer);
}
else
{
flowToken = Execute(actionExecutor, entityToken, actionToken,
flowControllerServicesContainer);
}
}
finally
{
if (taskManagerService != null)
{
flowControllerServicesContainer.RemoveService(taskManagerService);
}
}
taskContainer.SetOnIdleTaskManagerEvent(new FlowTaskManagerEvent(flowToken));
taskContainer.UpdateTasksWithFlowToken(flowToken);
taskContainer.SaveTasks();
}
ActionEventSystemFacade.FireOnAfterActionExecution(entityToken, actionToken, flowToken);
IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
if (managementConsoleMessageService != null)
{
FlowControllerFacade.RegisterNewFlowInformation(flowToken, entityToken, actionToken, managementConsoleMessageService.CurrentConsoleId);
}
else
{
LoggingService.LogWarning("ActionExecutorFacade", "Missing ManagementConsoleMessageService, can not register the flow");
}
return flowToken;
}
else
{
return ExecuteEntityTokenLocked(actionToken, entityToken, flowControllerServicesContainer);
}
}