| Author |
Share Topic Topic Search Topic Options
|
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Topic: Accessing data before login Posted: 17-May-2010 at 2:58pm |
For anyone following. To get the same functionality I had in the my Classic version. I used the EntityServerQueryInterceptor.ClientCanQuery and ClientCanSave. If the principal was administrator I passed if not I called a static method, using reflection, for the class type (either CanQuery or CanSave) if the method didn't exist then I passed. If it did exist then I evaluated and returned the result.
I needed the functionality at an entity level not global level. Each entity had different permissions based on many different roles.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 11-May-2010 at 12:20pm |
the docs talk about it but don't show any examples of how to use it.
|
 |
stephenmcd1
DevForce MVP
Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
|
Post Options
Quote Reply
Posted: 11-May-2010 at 11:45am |
Originally posted by orcities
So would you suggest the other Guest account or what would you suggest? And it is 2-tier. |
For what it's worth, in our application, we implemented a Guest account (like you, it's used during the logon process) and it's seemed to work well. We have a server-side "white-list" of specific tables and stored procedures that are allowed to be used by the Guest account and any attempt to access any other tables/stored procedures/PassthruEsql, etc. raises an Exception.
|
 |
stephenmcd1
DevForce MVP
Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
|
Post Options
Quote Reply
Posted: 11-May-2010 at 11:40am |
Originally posted by orcities
What assembly is the IEntityServerSaving interface under. I can not seem to find it. I have tried core, entitymodel and validation. |
The IEntityServerSaving interface was how it was done in DevForce 2009. In 2010, they moved to the EntityServerQueryInterceptor and EntityServerSaveInterceptor classes. They are both in the IdeaBlade.EntityModel.Server assembly.
You can read about them in the Business Object Persistence.pdf help file.
Hope that helps!
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 11-May-2010 at 11:17am |
|
What assembly is the IEntityServerSaving interface under. I can not seem to find it. I have tried core, entitymodel and validation.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 11-May-2010 at 8:09am |
|
So would you suggest the other Guest account or what would you suggest? And it is 2-tier.
Edited by orcities - 11-May-2010 at 8:09am
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 10-May-2010 at 7:46pm |
|
The exception is occurring because GetDataSourceKey returns a ClientEdmKey, not the EdmKey type on which the DbConnectionString property is defined. There is a constructor for the EdmKey which takes a ClientEdmKey, but unless your application is 2-tier, you generally don't want to set up a requirement for the IdeaBlade.EntityModel.Edm assembly, which is logically "server side" only.
|
 |
ting
IdeaBlade
Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
|
Post Options
Quote Reply
Posted: 10-May-2010 at 6:24pm |
One idea is to create a Guest account and login with the EntityManager on that account before the actual user login. You can query for pre-login data on the guest account and restrict its access on the server using the IEntityServerSaving and IEntityServerQuerying interfaces.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 10-May-2010 at 12:10pm |
During my login process I want to access some additional data. I want to present this data on the login screen. How would I go about doing that. I have tried the below but it comes back with null ref exception:
EntityManager man = EntityManager.DefaultEntityManager; System.Type t = IdeaBlade.Core.InternalFns.GetIdeaBladeType("IdeaBlade.EntityModel.Edm.EdmKey", true); _connectionString = t.GetProperty("DbConnectionString").GetValue(man.DataSourceResolver.GetDataSourceKey("EntityManager"), null) as String;
Error:
Target does not match target type;.
Casting to an object isn't the issue. I thing it is the GetResourceKey value that is returned.
Any help would be great.
|
 |