question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose user info for scaffold templates

See original GitHub issue

Feature Suggestion

When writing scaffolder templates, it would be useful to have some basic info about the user who triggered the job injected so it can be used when composing action steps. Some values to start with might be: {{ user.name }} {{ user.username }} {{ user.email }}

Possible Implementation

Not sure?

Context

The same way we are able to grab the form UI parameters with {{ parameters.name }} and action outputs with {{ steps.publish.output.remoteUrl }}, we would like to grab some basic user info to use as inputs to actions eg. setting the input.access to the users username for publish:github

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:24 (16 by maintainers)

github_iconTop GitHub Comments

6reactions
kuangpcommented, Feb 15, 2022

This is the full implementation for our workaround:

const CurrentUserField = ({ onChange }: FieldProps<string>) => {
  const identityApi = useApi(identityApiRef);

  useAsync(async () => {
    const identity = await identityApi.getBackstageIdentity();
    const { name: userId } = parseEntityRef(identity.userEntityRef);
    onChange(userId);
  });

  return (<></>);
};

export const CurrentUserFieldExtension = scaffolderPlugin.provide(createScaffolderFieldExtension({
  component: CurrentUserField,
  name: 'GetCurrentUser',
}));
4reactions
kuangpcommented, Dec 27, 2021

still relevant

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET MVC - Override the Default Scaffold Templates
Explore the CRUD Scaffold Workflow. Let's first examine the default scaffold's function. I'll add a controller by right-clicking the Web project's Controllers ...
Read more >
visual studio 2015 - View scaffold templates in ASP.NET Core ...
This uses a T4 template file to generate a CSHTML file based on a ... These steps do expose the UI for scafolding...
Read more >
Templates or Scaffolding for CRUD server actions - Read Only ...
What I'm not finding are templates or simple ways of creating a core set of CRUD routines / server actions per entity. There...
Read more >
Scaffolding and the Site Template - Yesod
The scaffolded site is a combination of many Yesoders' best practices combined together into a ready-to-use skeleton for your sites. It is highly...
Read more >
A Guide to Scaffold Use in the Construction Industry
information on these outreach efforts, see page 12 of this booklet. The agency's recent rule, Safety Standards for. Scaffolds Use in the Construction ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found