public static RbacDBOperations ParseOperations(bool create = false, bool read = false, bool update = false, bool delete = false)
        {
            RbacDBOperations operations = RbacDBOperations.None;

            if (create)
            {
                operations  = operations | RbacDBOperations.Create;
                operations &= ~RbacDBOperations.None;
            }
            if (read)
            {
                operations  = operations | RbacDBOperations.Read;
                operations &= ~RbacDBOperations.None;
            }
            if (update)
            {
                operations  = operations | RbacDBOperations.Update;
                operations &= ~RbacDBOperations.None;
            }
            if (delete)
            {
                operations  = operations | RbacDBOperations.Delete;
                operations &= ~RbacDBOperations.None;
            }
            return(operations);
        }
Example #2
0
 public RbacColumn(string name, RbacDataTypes dataType,
                   bool create = false, bool read = false, bool update = false)
 {
     this.Name     = name;
     this.DataType = dataType;
     //this.IsFilterColumn = isFilterColumn;
     this.AllowedOperations = Rbac.ParseOperations(create, read, update, false);
 }
Example #3
0
 public RbacColumn(string name, string dataType, string create = "False", string read = "False", string update = "False")
 {
     switch (dataType)
     {
     case "numeric":
         dataType = "Decimal";
         break;
     }
     this.Name              = name;
     this.DataType          = (RbacDataTypes)Enum.Parse(typeof(RbacDataTypes), dataType, true);
     this.AllowedOperations = Rbac.ParseOperations(create, read, update, "False");
 }
Example #4
0
 public static bool CanDelete(this RbacDBOperations allowedOperations)
 {
     return(allowedOperations.HasFlag(RbacDBOperations.Delete));
 }
Example #5
0
 public static bool CanRead(this RbacDBOperations allowedOperations)
 {
     return(allowedOperations.HasFlag(RbacDBOperations.Read));
 }