Show / Hide Table of Contents

    Class PermissionExtensions

    A set of extension methods that simplify working with object level permissions.

    Inheritance
    Object
    PermissionExtensions
    Namespace: Realms.Sync
    Assembly: Realm.dll
    Syntax
    public static class PermissionExtensions

    Methods

    | Improve this Doc View Source

    Add(IList<PermissionUser>, User)

    A convenience method that converts a User to PermissionUser and adds it to the list of users if necessary. If a PermissionUser with that identity already belongs to the collection, this method will be a no-op.

    Declaration
    public static void Add(this IList<PermissionUser> users, User user)
    Parameters
    Type Name Description
    IList<PermissionUser> users

    The collection of users to which user will be added.

    User user

    The user to add.

    | Improve this Doc View Source

    GetPrivileges(Realm)

    Returns the computed privileges which the current user has for this Realm.

    This combines all privileges granted on the Realm by all Roles which the current User is a member of into the final privileges which will be enforced by the server.

    The privilege calculation is done locally using cached data, and inherently may be stale.It is possible that this method may indicate that an operation is permitted but the server will still reject it if permission is revoked before the changes have been integrated on the server.

    Non-synchronized Realms always have permission to perform all operations.

    Declaration
    public static RealmPrivileges GetPrivileges(this Realm realm)
    Parameters
    Type Name Description
    Realm realm

    The Realm whose privileges are inspected.

    Returns
    Type Description
    RealmPrivileges

    The privileges which the current user has for the current Realm.

    | Improve this Doc View Source

    GetPrivileges(Realm, RealmObject)

    Returns the computed privileges which the current user has for the given object.

    Declaration
    public static ObjectPrivileges GetPrivileges(this Realm realm, RealmObject obj)
    Parameters
    Type Name Description
    Realm realm

    The Realm whose privileges are inspected.

    RealmObject obj

    A managed object to get the privileges for.

    Returns
    Type Description
    ObjectPrivileges

    The privileges which the current user has for the given object.

    Remarks

    This combines all privileges granted on the object by all Roles which the current User is a member of into the final privileges which will be enforced by the server.

    The privilege calculation is done locally using cached data, and inherently may be stale. It is possible that this method may indicate that an operation is permitted but the server will still reject it if permission is revoked before the changes have been integrated on the server.

    Non-synchronized Realms always have permission to perform all operations.

    The object must be a valid object managed by this Realm. Passing in an invalidated object, an unmanaged object, or an object managed by a different Realm will throw an exception.

    | Improve this Doc View Source

    GetPrivileges(Realm, String)

    Returns the computed privileges which the current user has for the given class.

    This combines all privileges granted on the class by all Roles which the current User is a member of into the final privileges which will be enforced by the server.

    The privilege calculation is done locally using cached data, and inherently may be stale. It is possible that this method may indicate that an operation is permitted but the server will still reject it if permission is revoked before the changes have been integrated on the server.

    Non-synchronized Realms always have permission to perform all operations.

    Declaration
    public static ClassPrivileges GetPrivileges(this Realm realm, string className)
    Parameters
    Type Name Description
    Realm realm

    The Realm whose privileges are inspected.

    String className

    The name of a RealmObject inheritor to get the privileges for.

    Returns
    Type Description
    ClassPrivileges

    The privileges which the current user has for the given class.

    | Improve this Doc View Source

    GetPrivileges<T>(Realm)

    Returns the computed privileges which the current user has for the given class.

    This combines all privileges granted on the class by all Roles which the current User is a member of into the final privileges which will be enforced by the server.

    The privilege calculation is done locally using cached data, and inherently may be stale. It is possible that this method may indicate that an operation is permitted but the server will still reject it if permission is revoked before the changes have been integrated on the server.

    Non-synchronized Realms always have permission to perform all operations.

    Declaration
    public static ClassPrivileges GetPrivileges<T>(this Realm realm)
    
        where T : RealmObject
    Parameters
    Type Name Description
    Realm realm

    The Realm whose privileges are inspected.

    Returns
    Type Description
    ClassPrivileges

    The privileges which the current user has for the given class.

    Type Parameters
    Name Description
    T

    The RealmObject inheritor to get the privileges for.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Realm
    Generated by DocFX