Path: redb/redb.Core/Models/Permissions/PermissionRequest.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Models/Permissions/PermissionRequest.cs
----
namespace redb.Core.Models.Permissions
{
///
/// Request for creating or updating permission
///
public class PermissionRequest
{
///
/// User ID (null if permission is for role)
///
public long? UserId { get; set; }
///
/// Role ID (null if permission is for user)
///
public long? RoleId { get; set; }
///
/// Object ID (0 for global permissions)
///
public long ObjectId { get; set; }
///
/// Read permission
///
public bool? CanSelect { get; set; }
///
/// Permission to create child objects
///
public bool? CanInsert { get; set; }
///
/// Edit permission
///
public bool? CanUpdate { get; set; }
///
/// Delete permission
///
public bool? CanDelete { get; set; }
///
/// Validate request
///
public bool IsValid()
{
// Either user or role must be specified, but not both
if (UserId.HasValue && RoleId.HasValue)
return false;
if (!UserId.HasValue && !RoleId.HasValue)
return false;
// At least one permission must be specified
if (!CanSelect.HasValue && !CanInsert.HasValue && !CanUpdate.HasValue && !CanDelete.HasValue)
return false;
return true;
}
}
}