internal static int GetWritePermission(StoragePermissionWrite writePermission) { switch (writePermission) { case StoragePermissionWrite.NoWrite: return(0); case StoragePermissionWrite.OwnerWrite: return(1); default: return(1); } }
public Builder Update(string bucket, string collection, string record, string version, StoragePermissionRead readPermission, StoragePermissionWrite writePermission, List <TStorageUpdate.Types.StorageUpdate.Types.UpdateOp> ops) { var update = new TStorageUpdate.Types.StorageUpdate { Key = new TStorageUpdate.Types.StorageUpdate.Types.StorageKey { Bucket = bucket, Collection = collection, Record = record, Version = version }, Ops = { ops }, PermissionRead = NStorageWriteMessage.GetReadPermission(readPermission), PermissionWrite = NStorageWriteMessage.GetWritePermission(writePermission), }; message.payload.StorageUpdate.Updates.Add(update); return(this); }
public Builder Write(string bucket, string collection, string record, string value, StoragePermissionRead readPermission, StoragePermissionWrite writePermission, string version) { var data = new TStorageWrite.Types.StorageData { Bucket = bucket, Collection = collection, Record = record, Value = value, Version = version, PermissionRead = GetReadPermission(readPermission), PermissionWrite = GetWritePermission(writePermission) }; message.payload.StorageWrite.Data.Add(data); return(this); }