Dear,
For a new project I need to create an employee object that inherits from User. We use complex security.
The employee is related to a company object (it is a multi company solution).
How can we add the company (dropdown) to the login form and validate it?
How can we by default filter all listviews to the company related to the logged on user?
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Peter,
To add a drop-down window, inherit from the AuthenticationStandardLogonParameters in the following manner:
<NonPersistent> _ Public Class MyStandardLogonParameters Inherits AuthenticationStandardLogonParameters Private objectSpace_Renamed As ObjectSpace Private user_Renamed As BasicUser Private availableUsers_Renamed As IList(Of BasicUser) <Browsable(False)> _ Public ReadOnly Property AvailableUsers() As IList(Of BasicUser) Get If objectSpace_Renamed Is Nothing Then Throw New InvalidOperationException("session") End If If availableUsers_Renamed Is Nothing Then availableUsers_Renamed = ObjectSpace.CreateCollection(Of BasicUser)() End If Return availableUsers_Renamed End Get End Property <Browsable(False)> _ Public Property ObjectSpace() As ObjectSpace Get Return objectSpace_Renamed End Get Set(ByVal value As ObjectSpace) objectSpace_Renamed = value End Set End Property <DataSourceProperty("AvailableUsers")> _ Public Property User() As BasicUser Get Return user_Renamed End Get Set(ByVal value As BasicUser) user_Renamed = value End Set End Property End Class
Also, you need to create your AuthenticationStandardLogonParameters descendant when creating your security:
winApplication.Security = New SecuritySimple(GetType(BasicUser), New AuthenticationStandard(Of BasicUser, MyStandardLogonParameters)())
See the attachment.
Thanks,
Marina
Marina,
I've seen your attachment but still do not completly understand how to setup.
I want an employee object (which must inherit from complexuser) which relates to a company. (1 user 1 company)
So the employee type is the one that logs on. during logon i want to display the available companies in the system (i know how to do that from your sample. However of course I do not want to see the button NEW in the popup window).
so we are authenticating Employees instead of users with roles and permissions.
After logging on I want to update an object to preserve logged in users.
can you change the sample to explain how to do this?
my 2nd question was How can we by default filter all listviews to the company related to the logged on user?
Peter
Hi Peter,
Please post separate questions in different threads. I've answered that question in the How can we by default filter all listviews to the company related to the logged on user? issue.
As for the current question, I'm still working on this issue and will post an answer as soon as possible.
Thanks,
Marina
Hi Peter,
Sorry for the delay. To hide a new button, use the ReadOnlyCollection as a container for users:
<Browsable(False)> _ Public ReadOnly Property AvailableUsers() As ReadOnlyCollection(Of BasicUser) Get If objectSpace_Renamed Is Nothing Then Throw New InvalidOperationException("session") End If If availableUsers_Renamed Is Nothing Then availableUsers_Renamed = ObjectSpace.CreateCollection(Of BasicUser)() End If Return New ReadOnlyCollection(Of BasicUser)(availableUsers_Renamed) End Get End Property
Also, as I see your task is rather complex and I advise that you review our AuthenticationStandard class ("C:\Program Files\Developer Express Inc\eXpressApp Framework v8.1\Sources\DevExpress.ExpressApp.Modules\DevExpress.ExpressApp.Security\AuthenticationStandard.cs" ). It might help you understand the authentication mechanism better.
Thanks,
Marina
Marina,
I came along way but not complete. I made a new module consisting of a Company Object and an Employee Object that inherits from User.
Secondly I created the customlogon class where I want to display this.
However I can not hook up the module in a new XAF Application and defining the Security in the Program.vb
I included the module
Hi,
To turn on your own classes instead of built-in ones use the WinApplication.Security property. For the ComplexSecurity, you can define a new security with 3 parameters, including the user type and authentication. Also, please review the
Security System Overview article. If this doesn't help please provide me more information on your authentication mechanism and scenario. For example, a user sees a logon window, finds his company in the drop-down editor, and then another drop-down editor is automatically populated with users from the selected company, and the user simply enters the password.
Thanks,
Marina
Hi Marina,
The link you provided did not work. I looked it up in the online help but already before but can't figure it out.
The scenario you say for example is EXACTLY what we want.
a user sees a logon window, finds his company in the drop-down editor, and then another drop-down editor is automatically populated with users from the selected company, and the user simply enters the password.
Can you alter the sample I sent you to make this work?
thanks in advance
PEter
Hi Peter,
It's a complex task and I need some time to implement it. However, I believe it's a rather useful functionality. I am working on a sample, and will post it as soon as possible. Also, we'll create a knowledge base article, or add a code snippet to our help. Please bear with us.
Thanks,
Marina
Marina,
thanks so far we are looking forward to see the solution you come up with.
Basically in every 'world class' application you need something like this.
to make the sample you also want to publish in the KB complete, maybe its nice to add a dropdown on the login form with the languages available from the model (localized) and when the user logins in and select e.g. German the thread culture is automatically set to his preference. this enables users to work e.g. in English UI eventhough they might have a German or French PC.
as you might have seen i tried to implement it as a module, so I can reuse it in all our XAF based applications (windows and web)
Hi,
I've attached a sample that helps you to implement your solution. Soon, we'll create a knowledge base. Also, please note that it's impossible to implement this functionality for the Web application yet. We have a bug (B30637) that doesn't allow it. Please track it to be notified about its status.
Thanks,
Marina
Marina
When can we expect the KB article?
The solution you attached is not even close in the direction of a solution
Hi Peter,
We have just released the v8.1.2 version where the bug was fixed, and the knowledge base will be created using the Web part. So, please wait for just a short while. We'll post an article as soon as possible. Also, please note the sample illustrates the approach, and you should encounter no problems implementing your functionality.
Thanks,
Marina
Hi Peter,
The knowledge base is created. Please refer to it: OBSOLETE - How to customize your Logon window?. Also, I've attached a sample that illustrates how to specifically accomplish your task. Instead of the LastLogonParametersReading event, you need to handle the DetailViewCreating in the following manner:
Private Shared Sub application_DetailViewCreating(ByVal sender As Object, ByVal e As DetailViewCreatingEventArgs) If TypeOf e.Obj Is MyLogonParameters Then Dim app As XafApplication = CType(sender, XafApplication) Dim objectSpace As ObjectSpace = app.ObjectSpaceProvider.CreateObjectSpace() CType(e.Obj, MyLogonParameters).ObjectSpace = objectSpace e.View = New DetailView(app.GetViewInfo(e.ViewID), objectSpace, e.Obj, app, e.IsRoot) End If End Sub
Thanks,
Marina