/// <summary> /// Check whether or not any of the roles is accociated with a certain action identifier. /// </summary> /// <returns></returns> public Boolean ApplicationActionExists(IUserContext userContext, String identifier) { if (this.IsNotEmpty()) { foreach (IRole role in this) { if (role.Authorities.IsNotEmpty()) { foreach (IAuthority authority in role.Authorities) { if (authority.ActionGUIDs.IsNotEmpty()) { List <Int32> actionIds = new List <Int32>(); foreach (String actionId in authority.ActionGUIDs) { actionIds.Add(Int32.Parse(actionId)); } ApplicationActionList actions = CoreData.ApplicationManager.GetApplicationActionsByIds(userContext, actionIds); foreach (IApplicationAction action in actions) { if (action.Identifier == identifier) { return(true); } } } } } } } return(false); }
public void GetApplicationActions() { ApplicationActionList ApplicationActionList; ApplicationActionList = GetApplicationDataSource(true).GetApplicationActions(GetUserContext(), Settings.Default.TestApplicationId); Assert.IsTrue(ApplicationActionList.IsNotEmpty()); Assert.IsInstanceOfType(ApplicationActionList[0], typeof(ApplicationAction)); }
/// <summary> /// Get list of application action objects. /// May be null if no application action object exists. /// </summary> /// <param name="userContext">User context.</param> /// <param name="applicationActionIdList">List of application action id</param> /// <returns>ApplicationActionList.</returns> public ApplicationActionList GetApplicationActionsByIdList(IUserContext userContext, List <Int32> applicationActionIdList) { ApplicationActionList _applicationActionList; _applicationActionList = new ApplicationActionList(); if (applicationActionIdList.IsNotEmpty()) { // Get application action list _applicationActionList = CoreData.ApplicationManager.GetApplicationActionsByIds(userContext, applicationActionIdList); } return(_applicationActionList); }
/// <summary> /// Get list of application action objects. /// May be null if no application action object exists. /// </summary> /// <param name="userContext">User context.</param> /// <param name="applicationActionGuids">List of application action GUIDs</param> /// <returns>ApplicationActionList.</returns> public ApplicationActionList GetApplicationActionsByGUIDs(IUserContext userContext, List <String> applicationActionGuids) { ApplicationActionList applicationActions = new ApplicationActionList(); if (applicationActionGuids.IsNotEmpty()) { // Get application action list applicationActions = CoreData.ApplicationManager.GetApplicationActionsByGUIDs(userContext, applicationActionGuids); } return(applicationActions); }
public void GetApplicationActionsByGUIDs() { ApplicationActionList ApplicationActionList; List <String> applicationActionGUIDs = new List <String>(); applicationActionGUIDs.Add("3"); applicationActionGUIDs.Add("4"); ApplicationActionList = GetApplicationDataSource(true).GetApplicationActionsByGUIDs(GetUserContext(), applicationActionGUIDs); Assert.IsTrue(ApplicationActionList.IsNotEmpty()); Assert.IsInstanceOfType(ApplicationActionList[0], typeof(ApplicationAction)); }
public void GetApplicationActionsByIdList() { ApplicationActionList ApplicationActionList; List <Int32> applicationActionIdList = new List <Int32>(); applicationActionIdList.Add(3); applicationActionIdList.Add(4); ApplicationActionList = GetApplicationDataSource(true).GetApplicationActionsByIds(GetUserContext(), applicationActionIdList); Assert.IsTrue(ApplicationActionList.IsNotEmpty()); Assert.IsInstanceOfType(ApplicationActionList[0], typeof(ApplicationAction)); }
public void GetApplicationActions() { ApplicationActionList applicationActionList; List <Int32> applicationActionIdList = new List <Int32>(); applicationActionList = new ApplicationActionList(); applicationActionIdList.Add(3); applicationActionIdList.Add(4); applicationActionList = GetAuthority(true).GetApplicationActionsByIdList(GetUserContext(), applicationActionIdList); Assert.IsTrue(applicationActionList.IsNotEmpty()); Assert.IsInstanceOfType(applicationActionList[0], typeof(ApplicationAction)); Assert.IsTrue(applicationActionList.Count > 1); }
/// <summary> /// Get ApplicationActionList from list of WebApplicationActions /// </summary> /// <param name="userContext">User context.</param> /// <param name="webApplicationActionList">List of WebApplicationActions.</param> /// <returns>ApplicationActionList.</returns> private ApplicationActionList GetApplicationActions(IUserContext userContext, List <WebApplicationAction> webApplicationActionList) { ApplicationActionList applicationActionList; CheckTransaction(userContext); applicationActionList = new ApplicationActionList(); if (webApplicationActionList.IsNotEmpty()) { foreach (WebApplicationAction webApplicationAction in webApplicationActionList) { applicationActionList.Add(GetApplicationAction(userContext, webApplicationAction)); } } return(applicationActionList); }