Skip to content

feat(configurable-actions): add userinfo in configurable-actions#2415

Closed
belfhi wants to merge 6 commits into
SciCatProject:masterfrom
belfhi:configurable-actions-userinfo
Closed

feat(configurable-actions): add userinfo in configurable-actions#2415
belfhi wants to merge 6 commits into
SciCatProject:masterfrom
belfhi:configurable-actions-userinfo

Conversation

@belfhi

@belfhi belfhi commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

We want to create Jobs via configurable-actions and the email field needs to be populated by the current user's email address.
This PR adds this functionality.

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Summary by Sourcery

Expose current user information as variables in configurable actions and document the new placeholders.

New Features:

  • Allow configurable actions to resolve #Username and #UserEmail placeholders using the currently logged-in user's profile.

Documentation:

  • Document the new #Username and #UserEmail placeholders in the configurable actions technical guide.

@belfhi belfhi requested a review from a team as a code owner June 11, 2026 10:43

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • Consider replacing the userObject: any parameter in processSelector with a strongly-typed user profile interface so that misuse and typos on fields like username/email are caught at compile time.
  • It might be safer to guard against this.userProfile being undefined/null before passing it into processSelector, and define a clear fallback behavior when user information is not available.
  • For consistency with existing selectors like #datasetOwner and #userIsAdmin, consider using a consistent naming convention (e.g. #userName, #userEmail) for the new user-related selectors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider replacing the `userObject: any` parameter in `processSelector` with a strongly-typed user profile interface so that misuse and typos on fields like `username`/`email` are caught at compile time.
- It might be safer to guard against `this.userProfile` being undefined/null before passing it into `processSelector`, and define a clear fallback behavior when user information is not available.
- For consistency with existing selectors like `#datasetOwner` and `#userIsAdmin`, consider using a consistent naming convention (e.g. `#userName`, `#userEmail`) for the new user-related selectors.

## Individual Comments

### Comment 1
<location path="src/app/shared/modules/configurable-actions/configurable-action.component.ts" line_range="130" />
<code_context>

   private processSelector(
     jsonObject: ActionItems,
+    userObject: any,
     selector: string,
   ): string | string[] | number | number[] {
</code_context>
<issue_to_address>
**suggestion:** Avoid `any` for `userObject` and describe its shape explicitly.

Given we access specific fields like `username` and `email` on `userObject`, please introduce a typed interface (e.g. `UserProfile`) and use that instead of `any` to document expected properties and gain type safety.

Suggested implementation:

```typescript
interface UserProfile {
  username: string;
  email: string;
}

export class ConfigurableActionComponent

```

```typescript
  private processSelector(
    jsonObject: ActionItems,
    userObject: UserProfile,
    selector: string,
  ): string | string[] | number | number[] {

```

If the class name in this file is not `ConfigurableActionComponent`, adjust the first SEARCH/REPLACE block to match the actual `export class ...` line so the `UserProfile` interface is inserted in the appropriate place.
You may also want to expand `UserProfile` with any additional fields accessed elsewhere in the component to keep type usage consistent.
</issue_to_address>

### Comment 2
<location path="docs/contributors/configurable_actions_technical.md" line_range="153" />
<code_context>
 | #uuid | string | A v4 uuid generated on the fly |
+| #Username | string | The currently logged in user's username |
+| #UserEmail | string | email address of the user |
 | @variable | any | replace the string with the valu eof the variable defined in the action variable |

 ## How to Configure
</code_context>
<issue_to_address>
**issue (typo):** Fix the typo "valu eof" to "value of".

```suggestion
| @variable | any | replace the string with the value of the variable defined in the action variable |
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/app/shared/modules/configurable-actions/configurable-action.component.ts Outdated
Comment thread docs/contributors/configurable_actions_technical.md Outdated
@belfhi belfhi changed the title feat: Add Userinfo in configurable actions feat(configurable-actions): Add Userinfo in configurable actions Jun 11, 2026
@belfhi belfhi changed the title feat(configurable-actions): Add Userinfo in configurable actions feat(configurable-actions): add userinfo in configurable-actions Jun 11, 2026
@belfhi belfhi changed the title feat(configurable-actions): add userinfo in configurable-actions feat(configurable-actions): add userinfo in configurable-actions Jun 11, 2026
@minottic

Copy link
Copy Markdown
Member

@belfhi sorry to jump in, I had a similar change here #2350 #2351 . Is it fine if I resolve commits in mine and we see how they overlap?

@belfhi

belfhi commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi Carlo, I wasn't aware that you had proposed those changes. We can resolve your PR, that's ok to me.

@belfhi

belfhi commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

closing since this functionality was added in #2350

@belfhi belfhi closed this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants