bamaer commented on code in PR #8631:
URL: https://github.com/apache/hop/pull/8631#discussion_r4159025349
##########
core/src/main/java/org/apache/hop/core/security/HopSecurity.java:
##########
@@ -70,6 +72,22 @@ public static HopSecurityContext getContext() {
return context != null ? context : HopSecurityContext.unrestricted();
}
+ /**
+ * The name to record in the audit fields of a file, such as the user who
created or last modified
+ * a pipeline or workflow.
+ *
+ * <p>Only an authenticated context yields a name. The desktop runs
unrestricted under the {@link
+ * HopSecurityContext#ANONYMOUS_USERNAME} placeholder, and neither that
placeholder nor the
+ * operating system account name says anything about who edited the file, so
those cases return an
+ * empty result and leave whatever the file already holds untouched.
+ *
+ * @return the authenticated user name, or empty when no real user is known
+ */
+ public static Optional<String> getAuditUsername() {
+ HopSecurityContext context = getContext();
+ return context.isAuthenticated() ? Optional.of(context.getUsername()) :
Optional.empty();
Review Comment:
Fixed in f0e98c3. The stand-in name is now
`HopSecurityPrivilegeMode.STAND_IN_USERNAME`, and `getAuditUsername()` returns
empty for it. I added `aDesktopRoleSimulationIsNeverWrittenAsAUser`, which uses
`createEffective(HopSecurityContext.unrestricted(), HopRole.READ_ONLY)` as you
suggested. Without the fix it fails with `expected: <-> but was: <session>`. I
didn't use the base context because core can't reach it; it lives in the
rcp/rap providers.
##########
engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java:
##########
@@ -111,6 +111,15 @@ public class WorkflowMeta extends AbstractMeta
@HopMetadataProperty(inline = true)
protected WorkflowMetaInfo info;
+ /**
+ * The version string for the workflow.
+ *
+ * @deprecated since 2.20, for removal. The label has to be set and updated
by hand and says
+ * nothing that the version control system holding the file does not
already say more
+ * reliably. It is still read from and written to the file, so no
existing value is lost
+ * before it is removed.
+ */
+ @Deprecated(since = "2.20", forRemoval = true)
Review Comment:
Agreed on the version fields. `workflowVersion`, `pipelineVersion` and the
`PipelineMeta` accessors are no longer deprecated, and the docs are back to the
original wording. On the accessors: Lombok does copy a field's `@Deprecated`
onto the getters and setters it generates. Adding `@Getter(onMethod_ =
@__(@Deprecated(...)))` to `pipelineStatus` fails to compile with "Duplicate
annotation @Deprecated", and `javap` shows `getPipelineStatus` /
`setPipelineStatus` as `Deprecated: true`. They get a plain `@Deprecated`
without `since` / `forRemoval`, but call sites do warn.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]