package acl // RoleDef is the input shape for building an ACL — matches config.RoleCfg. type RoleDef struct { Users []string Actions []string } // FromRoles builds an ACL directly from a slice of Role values. func FromRoles(roles []Role) ACL { return ACL{roles: roles} } // FromMap builds an ACL from a map of role name → RoleDef. // This is the primary constructor used from the runtime. func FromMap(roles map[string]RoleDef) ACL { var rs []Role for name, def := range roles { rs = append(rs, Role{ Name: name, Users: def.Users, Actions: def.Actions, }) } return ACL{roles: rs} }