Forums

ObjectAccessPermission: CreateAccess & WriteAccess

Last post 9/9/2010 1:30 AM by Nyfor Chang. 1 replies.
Sort Posts: Previous Next
  • Nyfor Chang

    ObjectAccessPermission: CreateAccess & WriteAccess

    9/8/2010 11:54 PM
    • Not Ranked
    • Joined on 8/28/2010
    • Posts 2

    Hi,

    If I assign the CreateAccess(Allowed) and WriteAccess(Denied) permissions to my role, I Can create a new object, but the all detailview items are readonly because of writing access is denied.

    In this case, I thought I can create a new object and modify it's properties. Once I save the new object, it will be readonly.

    How to implement my only CreateAccess permission ?

    Thanks.

  • Nyfor Chang

    Re: ObjectAccessPermission: CreateAccess & WriteAccess

    9/9/2010 1:30 AM
    • Not Ranked
    • Joined on 8/28/2010
    • Posts 2

    Hello, I have try it out.

    I override the ObjectAccessComparer.IsSubsetOf method as following,

     

    public override bool IsSubsetOf(ObjectAccessPermission sourcePermission, ObjectAccessPermission targetPermission)
    {

        if (sourcePermission.Contexts.TargetObjectContext != null &&
            sourcePermission.Contexts.TargetObjectContext.TargetObject != null)
        {
            BaseObject obj = sourcePermission.Contexts.TargetObjectContext.TargetObject as BaseObject;
            if (obj != null && obj.Session.IsNewObject(obj))
                sourcePermission.WriteAccess = ObjectAccessModifier.None;
        }
        return base.IsSubsetOf(sourcePermission, targetPermission);

    }

     

    It works fine for me. Any error else?

    Thanks.

     

     

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.