Im new to WF and i'm trying to build an asp.net MVC web site with several WF "wizards". All users will be logged in using forms authentication. The users will have many different WF workflows they can start and come back and finish at a later date. I've added an SQL persistence store to store the state of the workflow which works so far. However it seems to me you need to know the guid of the workflow in order to reload it and carry on.
Is there a way i can add the users username to the persistence so that i could list the users currently active work flows so they can carry on where they left off? Each user could have several active work flows at any one time.
The persistence store supports Persistence IO Participants which can supply values to be persisted along with the workflow. The code is a little tricky but there are samples available, just look for PersistenceIOParticipant.
Related
The question is fairly simple, but I've yet to find an answer to it. Is it possible to use Google+ API in an asp.net-mvc web app that requires multiple tiers of users?
For example, this app basically needs three sets of users and permissions associated with each: Admins, Members, Guests. Mind you, I've never handled user authentication of any type before, so I'm happy to hear suggestions for other frameworks if you think those would be better.
I think its going to be very hard for you to get three sets of user credentials in a single app.
For you to be able to authenticate as user one your going to need user one to authenticate your application then you will have access to that users data. If you need access to user twos data your going to have to have that user authenticate your application. If you need access to both users the same time its going to be very hard for you to get this access unless they are both using the same computer together.
While it is possible to get a refresh token for user one returned which you could store on your server some place and then use that to access user ones data when user two is on their machine. This becomes a gray area as you are responsible of holding user ones data private especially from user two.
as for your different leaves of users thats just part of your system it should just be a matter of strong the users ids associated with their role within the system.
None of this has anything to do with doing this in .net. You could probably work it all out using the .net client library. Web applications (ASP.NET MVC)
I am designing a system (stack: MVC 5, EF6, SQL Server) which needs to capture a lot of information about user interaction with various components of the app.
E.g.
How much time a user spend on a particular screen.
What action is the user performing: viewing, editing a page/form
Idle time
Progress in a particular workflow
And show all this information on a Management dashboard which is part of the same web app.
The traditional way of doing this would be to fire a sql query when a certain action happens and save this information in the application database. The thing is that, I don't want to overload the main application server with all these tasks and this approach doesn't seem too robust to me.
I was reading about Application Insights (Telemetry and custom events) and it seems that it should work for my problem statement. The only problem is that it is very tightly coupled with Azure resources and portal dashboard (as per my understanding).
So my question is: Can I use ApplicationInsights package to capture metrics and persist the data in a local SQL database and show it on a custom dashboard?
I read about continuously exporting telemetry information from Azure Storage to Power BI or SQL DB but wont work for me because I cannot use Azure as an intermediary.
https://azure.microsoft.com/en-in/documentation/articles/app-insights-export-telemetry/
Would really appreciate some guidance on this. Thanks.
You can use PowerBI dashboards, with direct integration to Application Insights, specifically, with Analytics queries you likely may use in this scenario.
Also, you can consider using Application Insights API (https://dev.applicationinsights.io/) to achieve this directly, including integration with some popular dashboards. Note that API is now in early preview, so we may introduce some changes, but the overall shape should be stable.
I am also curious what prevents you from using Azure - we'd like to learn more about it. Please be aware of the fact that Application Insights stores it data in Azure
For the specific case when you want to use just Application Insights SDK, while storing and analyzing the data "locally" in your tool of choice - this is also possible. (Note: in this case you only benefit from App Insights SDK and schema, leave the door open for future possibility to use full App Insights). To achieve that, you can consider implementing a custom telemetry channel - see here for some additional information: http://apmtips.com/blog/2016/01/31/telemetry-channels-update
While implementing this approach, you should you should be mindful about the volumes - I would advocate for decoupling it through some form of a queue mechanism, makes it easier to protect your app, balance the load and also monitor ...
I have an MVC 5 application set up with windows authentication and my own custom roles table for authorization. This works fine if the user exists in my application database - username in my users table maps to the usernames in active directory.
My question is how do I keep my users table in sync with active directory. Any time a new user is hired, a new record has to be added to my intranet application to ensure this user has access to it.
Is there a way to load users from active directory into my own users table perhaps with some kind of scheduled job or is there a better way to achieve what I'm trying to do?
I think sync two database instances (AD database and you app database) will become management issue as your business grow. Even, adding new user and removing is day to day work, so in both cases you need to execute some sort of action to add or remove users from your app database.
Why don't you ask your team to give you access of AD database and consume this into your intranet app, this is what I was using in my past organization and this works great.
The AD can be used in a programmatic manner. Just look for LDAP stuff and you'll find lots of examples. Here's one to get you started : Connect to Active Directory via LDAP
If your application allows people to register then implement your own custom membership provider which talks to the AD. You can create the users in the AD, you will have to pass the password requirements which are set on the AD as well, which is more than likely a good thing. The roles information can be stored there as well, no need for a local custom roles table either.
I have an application which is centered around data per 'team'. A user belongs to a team and if they log in they only see that team's data.
However, I now have super users who essentially belong to more than one team. These users should be able to log in to the system and then immediately choose which team they are interested in. From then on they will essentially view/create data against that selected team. They should also have the option to go and change what team they are viewing at any time.
I've established that the user would like to be able to have multiple tabs open and be viewing a different team in each tab.
I'm struggling to work out the best way to accomplish this with .NET MVC while keeping it as stateless and testable as possible.
I've been reading up on the different ways to persist data - session state and cookies seem to get a bad rep in MVC. TempData, ViewBag seem to focus on just persisting data for one request.
I wouldn't have thought that this is an uncommon requirement in an application - are there known patterns for dealing with this in MVC which I have missed?
So far I'm trying to create a partial view which I can show on each page to let the user see what team they are viewing the site as, and change it from there.
Any advice is appreciated!
If you want to let your superuser view multiple teams data then you'll want to pass the team information in on the request, on the query string or as something that looks like a restful url:
/blueteam/members
In fact it would be extra work to track this in a stateful manner as you'd have track user, team, and ui element when a superuser can view multiple team data at once.
I'd say passing the information in on every request is a pretty standard approach to your situation.
The tricky part of the stateless approach is decorating all your internal application links with the team information without too much extra work. Relative links can be your friends here. So a link to the bug page for a team might be to simply "bugs", picking up the team name higher in the uri path. If you are creating something that looks like a one page application it's easy enough to store the team info on the client.
If you don't want team members to see data for other team members, you can set up guard functions that check for team membership for certain classes of users before rendering a view.
I'm contemplating using AFTER INSERT, DELETE, UPDATE Triggers to capture changes to one of my databases. One thing I want is to capture name of the user who made the change.
Since I'm using a dedicated SQL account to connect to the database (from ASP.NET MVC), I don't believe SUSER_SNAME() will provide accurate information to me.
Is there anyway for me to feed in the username from ASP.NET MVC side to the trigger?
ASP.NET side is configured for Windows Authentication against Active Directory.
Take a look at Set Context_Info. I've used this successfully in the past when auditing and using sql authentication. The idea is that you set the in the context the logged on user, then in the DB Trigger you retrieve this info from the context and store it in the DB. If you forget to set the user in the context, you can always fall back to suser_name (although, not very useful for auditing, but can be useful when making changes directly in SSMS). Google "Audit Trail Set Context_Info" and you will find some examples.
Like this one and this other one
You could use Thread.CurrentPrincipal to get the Windows Account and pass this as a parameter to your queries, and therefore, available to Triggers.
var userName = Thread.CurrentPrincipal.Identity.Name;