protected List <AuthorizedFlow> GetAllFlows() { List <AuthorizedFlow> unprotectedFlows = new List <AuthorizedFlow>(); IList <DataFlow> nodeFlows = _flowManager.GetAllDataFlows(false, false); if (!CollectionUtils.IsNullOrEmpty(nodeFlows)) { foreach (DataFlow nodeFlow in nodeFlows) { AuthorizedFlow authorizedFlow = new AuthorizedFlow(); authorizedFlow.FlowName = nodeFlow.FlowName; unprotectedFlows.Add(authorizedFlow); } } return(unprotectedFlows); }
protected GetAuthorizedUsersResponse GetAuthorizedUsersResponseData() { IList <UserAccount> nodeUsers = _accountManager.GetAllUsers(); GetAuthorizedUsersResponse response = new GetAuthorizedUsersResponse(); List <AuthorizedUser> responseUsers = new List <AuthorizedUser>(); if (!CollectionUtils.IsNullOrEmpty(nodeUsers)) { // Get list of unprotected flows: List <AuthorizedFlow> unprotectedFlows = GetUnprotectedFlows(); List <AuthorizedFlow> allFlows = GetAllFlows(); // Loop through each user to add them to the response list foreach (UserAccount nodeUser in nodeUsers) { AuthorizedUser responseUser = new AuthorizedUser(); responseUser.NAASUserName = nodeUser.NaasAccount; List <AuthorizedFlow> userAllowedFlows; if (nodeUser.Role == SystemRoleType.Admin) { userAllowedFlows = new List <AuthorizedFlow>(allFlows); } else { userAllowedFlows = new List <AuthorizedFlow>(unprotectedFlows); if (!CollectionUtils.IsNullOrEmpty(nodeUser.Policies)) { foreach (UserAccessPolicy userAccessPolicy in nodeUser.Policies) { if ((userAccessPolicy.PolicyType == ServiceRequestAuthorizationType.Flow) && (userAccessPolicy.FlowRoleType != FlowRoleType.None)) { AuthorizedFlow authorizedFlow = new AuthorizedFlow(); authorizedFlow.FlowName = userAccessPolicy.TypeQualifier; userAllowedFlows.Add(authorizedFlow); } } } } responseUser.AuthorizedFlowList = userAllowedFlows.ToArray(); responseUsers.Add(responseUser); } } response.AuthorizedUserList = responseUsers.ToArray(); return(response); }