Add a special case in ProcessState::is_valid() for demiurge role
This commit is contained in:
parent
e5024ff019
commit
6f786c5cc9
@ -118,7 +118,10 @@ impl ProcessState {
|
|||||||
// Collect applicable rules from all roles for the current field
|
// Collect applicable rules from all roles for the current field
|
||||||
let applicable_roles: Vec<RoleDefinition> = self.roles
|
let applicable_roles: Vec<RoleDefinition> = self.roles
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|(_, role_def)| {
|
.filter_map(|(role_name, role_def)| {
|
||||||
|
// We allow for a special case with a role that works only for initial state
|
||||||
|
// That's optional though
|
||||||
|
if previous_state.is_some() && *role_name == crate::SpecialRoles::DEMIURGE.to_string() { return None; }
|
||||||
let mut filtered_role_def = role_def.clone();
|
let mut filtered_role_def = role_def.clone();
|
||||||
let rules = filtered_role_def.get_applicable_rules(field);
|
let rules = filtered_role_def.get_applicable_rules(field);
|
||||||
filtered_role_def.validation_rules =
|
filtered_role_def.validation_rules =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user