Spring Boot 4 / Java 17 / Postgres. Masters and serving (A), Agmarknet and climate ingestion (B), feature store with 14 derivations (C), SpEL rule engine and risk scoring (D). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
42 lines
1.0 KiB
Java
42 lines
1.0 KiB
Java
package com.lincfusion.udyamlinc.master;
|
|
|
|
import jakarta.persistence.*;
|
|
import lombok.*;
|
|
|
|
/** Console RBAC. Permissions are a comma-separated set of MODULE:ACTION keys. */
|
|
@Entity
|
|
@Table(name = "role", indexes = @Index(name = "ix_role_code", columnList = "code", unique = true))
|
|
@Getter
|
|
@Setter
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public class Role {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
/** FIELD_OFFICER | SUPERVISOR | OWNER */
|
|
@Column(nullable = false, unique = true, length = 32)
|
|
private String code;
|
|
|
|
@Column(nullable = false, length = 64)
|
|
private String name;
|
|
|
|
/** e.g. "PORTFOLIO:VIEW,ALERT:ACT,VISIT:LOG" */
|
|
@Column(length = 600)
|
|
private String permissions;
|
|
|
|
/** System roles cannot be deleted from the console. */
|
|
private Boolean systemRole;
|
|
|
|
private Boolean active;
|
|
|
|
@PrePersist
|
|
void onCreate() {
|
|
if (active == null) active = Boolean.TRUE;
|
|
if (systemRole == null) systemRole = Boolean.FALSE;
|
|
}
|
|
}
|