3
I have my application, which shares the same database with all my customers.
Separating them only by a column of the table Empresa_Id
, all my actions, Save, List, Edit, Delete are done by my Pository.
In my Repospository I pass the Company Id, always before executing the action. But in my Edit, as it sends the ID through the URL to return to the View, I cannot handle it, and others may have access to other people’s data.
So what’s flawed is this method here from Repository:
public virtual T getById(int id)
{
return _dbSet.Find(id);
}
Any idea to get around this problem?
I even thought about changing my PK all to GUID, but I’m afraid my queries will be too slow (since the Entity Framework is famous for being a slow ORM compared to others).
Tiago, so I read already...but it’s complicated you know, I’m going through something very "similar" to what you mentioned... I have even made this way, to return Null if it is not the same "Company" etc...
– Rod
James, out of curiosity, succeeded by making that condition and returning Null in his Dit in the Pository ?
– Rod
Sorry James, confused, your "Get" returning Null when it is not from Empresaid
– Rod
Tiago, as I’m using Asp.net Identity, I leave Empresaid in Claims even... then I don’t need to search from the bank or something, it’s already in memory
– Rod