Class Privilege

java.lang.Object
com.sap.cds.services.utils.model.Privilege

public class Privilege extends Object
A Privilege specifies access rules for operations. A Where clause can be used to define instance-based access.

grant: one or more operations (as a string or an array of strings)
to: (optional) one or more user roles the privilege is granted to
where: (optional) a condition that further restricts access

example: { grant: ['READ','WRITE'], to: 'admin' } { grant: 'READ', where: 'buyer = $user' }

  • Constructor Details

    • Privilege

      public Privilege()
    • Privilege

      public Privilege(Map<String,Object> privilege, String entityName)
  • Method Details

    • copy

      public Privilege copy()
    • getGrants

      public List<String> getGrants()
    • addGrant

      public Privilege addGrant(Privilege.PredefinedGrant grant)
    • addGrant

      public Privilege addGrant(String grant)
    • getRoles

      public List<String> getRoles()
    • addRole

      public Privilege addRole(Privilege.PredefinedRole role)
    • addRole

      public Privilege addRole(String role)
    • getWhereCQL

      public String getWhereCQL()
    • setWhereCQL

      public void setWhereCQL(String whereCQL)
    • getWhereXpr

      public com.sap.cds.ql.cqn.CqnPredicate getWhereXpr()
    • setWhereXpr

      public void setWhereXpr(com.sap.cds.ql.cqn.CqnPredicate where)
    • hasWhere

      public boolean hasWhere()
    • getCxnWhereCondition

      public String getCxnWhereCondition()
    • setCxnWhereCondition

      public void setCxnWhereCondition(String cxnWhereCondition)
    • hasWhereUsing

      public boolean hasWhereUsing(String xpr)
    • is

      public static boolean is(String a, String b)