Ticket Q466829
Visible to All Users

Help with a solution from Q359904

created 11 years ago

Would you please help me with implementing the solution where you derive from XPObjectSpaceProviderThreadSafe?
I already implemented my own XPObjectSpaceProviderThreadSafe and everything works in that class but I don't know how to handle the property change properly in order to not get the validation exception.

This is how my property looks like (nothing special there):

public class Auditing
{
[Persistent("AuditingState")]
public AuditingState AuditingState
{
get
{
return _AuditingState;
}
set
{
SetPropertyValue("AuditingState", ref _AuditingState, value);
}
}
AuditingState _AuditingState = null;
}

Lets just say that AuditingState has a property called IsProtected, and if IsProtected is true then the user has no write permission for the Auditing. What do I have to do in order to not get the validation exception but still be able to see the property change in the LookupPropertyEditor so that the whole issue is transparent for the user?
I created a sample project to demonstrate my setup.

Show previous comments (6)
DevExpress Support Team 11 years ago

    Hi Bernd.
    We have researched your scenario and concluded that it cannot be implemented as is with the current implementation of the security system. We will take it into account when implementing the Security - Provide an easy way to create additional objects or modify protected properties in code (preferably within the same transaction) request. Currently, you can switch the Auditing object to the "closed" state via an action that modifies the database directly. For example:

    C#
    public class CloseAuditController : ViewController { public CloseAuditController() { TargetObjectType = typeof(Auditing); SimpleAction action = new SimpleAction(this, "CloseAudit", PredefinedCategory.Edit); action.SelectionDependencyType = SelectionDependencyType.RequireMultipleObjects; action.Execute += action_Execute; } void action_Execute(object sender, SimpleActionExecuteEventArgs e) { ObjectSpace.CommitChanges(); XPObjectSpaceProvider provider = new XPObjectSpaceProvider(Application.ConnectionString, null); using (IObjectSpace os = provider.CreateObjectSpace()) { AuditingState closedState = os.FindObject<AuditingState>(CriteriaOperator.Parse("IsProtected")); if (closedState == null) return; foreach (Auditing obj in e.SelectedObjects) { Auditing auditing = os.GetObject<Auditing>(obj); auditing.AuditingState = closedState; } os.CommitChanges(); } //ObjectSpace.Refresh(); View.Close(); } }

      I implemented the action in the way you proposed and it solved the issue. Thank you for your help!

      DevExpress Support Team 11 years ago

        You are welcome, Bernd.

        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.