I’m currently working on a LightSwitch (LS) app that will be use for tracking project workload across multiple departments in my organization. I intend on using Windows Authentication (Allow only user and AD sec groups) for my access control. I’ve hit a brick wall in my thought/design process. When approaching this project my first thought was to set up a “Users” table that will be referenced in my other tables when a user performs any DB insert. Heres a basic diagram to help illustrate:.
This is where I’m stuck. When you publish a LS app, you can choose to also publish the SQL DB schema that you designed in LS which i intend on doing. When it publishes the schema, it also includes the popular asp.net membership tables/SP’s. This is where where LS stores the applications users. Because this table isn't created until after the application has been published i can’t reference it in my code. And the reason i would like to reference it, is so when a user does a insert into the WorkLog table, i can use the username/ID. I can also use the username to do Row Level Security (RLS). Anyone have any suggestions on how i can achieve this?
Nutshell: I would like to reference the table that the registered users are stored in so i can use their username/userID in my other tables. I’m open to ANY suggestion at this point
I use a "Users" table to store many details that are not stored in the .net tables such as phone, picture, department,etc. and use the active directory account to compare the user, then use the "Users" properties in the app because the user has already been authenticated. That way, I can add any property to the Users table that I need and I don't need to change the .net tables. For auditing, You can use Beth Massi's blog or this forum link:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/21da645b-93ba-41c9-a224-ea6a74362d15/how-to-create-a-simple-audit-trail-change-log-in-lightswitch-in-c?forum=lightswitch
Scott
Related
My client asked to build an API in ASP NET Core for a business management application. Nonetheless, he made me an unusual requirement for me: He needs each user to have their own database. All databases have the same structure of tables and relationships and all are MySql.
This means that each user will need their own connection string and some way to store that information.
In addition, other users will be added in the future, each with a bank created just for their use.
Anyway, I don't know if this is possible, but if it is, how would I do it?
I am trying to create an application that has the ability to create user accounts that have a wide range of permissions. I am currently using the built in ASP.NET Core identity system, but I run into some problems that I haven't find any or haven't find any clean solutions and that will get explained later on the post. This had made me thinking of creating my own custom identity mechanism that will fit my needs.
The problems that I am facing are:
I am using MySQL as my db provider and upon creating the db tables I
was thrown the following exception "Specified key was too long: max
key length is 3072 bytes". I managed to fix this issue by
overriding the OnModelCreating method and manually changing the
HasMaxLength value using the following code
modelBuilder.Entity<IdentityUserLogin>().Property(ul => ul.LoginProvider).HasMaxLength(36);
It's not beautiful but it gets the job done.
I want my users to be able to add multiple emails and multiple
phone numbers to their accounts. The built in ASP.NET Core identity
creates an email and a phone number column in the users table. I know
I can prevent it from creating those columns but I really don't
believe that's the right solution. Basically what I need is to have a
table related to the users table that will store the users' emails
and one for the phone numbers following the same pattern.
My application will have the ability to create dynamic fields and
will also have the ability to give its users permissions related to
those fields (ex. CanSee,CanEdit,CanDelete). The built in Role
authorization system doesn't fit my requirements and I have seen a
lot of buzz surrounding the built in Claims authorization system. I
have actually read that the implementation of an authorization system
that is pretty close to what I need is very complicated and very hard
to maintain!
My question is, should I use the built in ASP.Net core identity system to achieve my goals even though I am facing the such problems? Are there any solutions to my problems that I don't know about and would make my life easier while using the ASP.Net core identity system? Should I create my own identity system and if so, how difficult and potentially dangerous such a system will be?
You should use ASP.NET Identity and customize it.
You should treat claims as permissions. Claims are at their base, authorized filters.
I am building a Web Api which is hosted on Azure. This project has Individual User Account authentication in it.
I have accidentally deleted the AspNetUsers table from my project and I do not know if it is possible to get it back. I have also deleted the _MigrationHistory table so I cannot get it back from there.
Is there any way to retrieve this table or even create a new one with identical columns. It does not matter about the missing User data I just need to be able to Register Users again.
I am using Entity Framework Code First. I tried adding a migration and updating the database but this does not work.
I think creating a new project is a last resort fix but I really don't want to have to do that!
I'm trying to save user-specific settings for my web application, but the amount of information out there is overwhelming me and I'm not sure what the standard way to do this is. It's a Google Maps application and the types of settings I am talking about are things like current map center, zoom level, etc so that when a user exits the application and returns it appears the same way as when they left it.
This is an MVC5 app. We are using Entity Framework database-first for storage, and the Identity API for user logins. My Googling shows that this is built on code-first, so I'm not sure what that means for me. I see a lot of information about the User Profiles API and cookies, but there is so much varying info that I'm not sure what is current or if there is some standard way to do this. I could just add tables to my database and stick these settings in there, but is there some more correct way to accomplish this? It seems like they should tie in to the Identity database somehow since it's already there.
We are currently in process of developing SAAS application codename FinAcuity which will be hosted on Windows Azure platform and primary database will be SQL Azure.
Here are some Technical Specifications for our product:
Development Environment - Asp.Net 4.0 with MVC 3 (Razor), Entity Framework
Database - SQL Azure
Here is our Business Case:
Our product is a SAAS product, And as it will contains Financial Data of Client, we are going to provide separate database to each client to achieve higher level of multi-tenancy, Data Isolation & Security.
Now Client can create multiple companies under their account and these companies will be separated by Schemas under particular Client DB.
Note: Table structure will be same for each Schema.
Here are some scenarios to will give you a deeper view of our application processes.
Scenario 1:
To provision new database upon client registration, we are going to run Store Procedure that will create database with basic structure.
Our Doubt: Is this correct way of doing it on SQL Azure or there is some other way for it?
Scenario 2:
For accessing multiple schemas under client database, we have dynamically generated SSDL file for individual schema and used that file for connection.
Our Doubt: Is there any other way of doing it, like using same SSDL file instance for multiple connections and passing Metadata for connection?
Scenario 3:
As our application supports ad-hoc querying and dynamic table creation from Excel file, we are going to provide wizard that will run Store Procedure in back-end and create that table dynamically from Excel file upon header selection from wizard under particular schema for client database.
Our Doubt: Suggest us a better way of doing it, if any?
Scenario 4:
Now as the new table is added to schema, we have to update EDMX file to get data from that new created table. To do this we are going to run Store Procedure that will fetch data from newly created table.
Our Doubt: Is there any way of updating EDMX file runtime and getting data?
Need advice for best possible solution for each scenario that is listed above.
Thank you in advance.
Best Regards - Sahil
I think this is a little too much for 1 single question.
And I personally think you look at it from a wrong perspective. Why did you choose Entity Framework and SQL Azure? Do you really think these are the best technologies to address your problems?
I suggest you take a step back and investigate what other technologies could be used. Because what you're asking here looks like a schema-less solution, and SQL Azure / SQL Server wasn't built for that IMHO.
You can start by looking at a NoSQL (schema-less, key value store) solution, possibly in Windows Azure. There's a whitepaper that will get you started on that: NoSQL and the Windows Azure platform -- Investigation of an Unlikely Combination
Windows Azure Table Storage is a key-value store that could solve some of your issues:
Customer isolation / Multiple schemas: WAZ Table Storage supports partitions, you could partition your data per customer instead of putting all the data together.
Provisioning: No need to provision anything. Get a storage account and you can get started. Then you can simply have some code that writes data in a specific partition for that customer.
Cost (not mentioned in the question): Table Storage is much cheaper than SQL Azure
...