Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: the default/first user created should get assigned to admin group #278

Closed
niftylettuce opened this issue Sep 8, 2017 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@niftylettuce
Copy link
Collaborator

not sure where the best place to do this is, but we should make the first user created/signed up get admin privilege

probably in the users find or create functionality, do a count or something, if it's 0 then give user admin group.

user's are signed up here https://github.com/ladjs/lad/blob/master/template/app/controllers/web/auth.js#L93-L96 so probably right before that code block something like:

  // register the user
  try {
    const count = await Users.count({ group: 'admin' });
    const user = await Users.registerAsync(
      { email: ctx.req.body.email, group: count === 0 ? 'admin' : ' user' },
      ctx.req.body.password
    );
@niftylettuce
Copy link
Collaborator Author

related to #277

@pablopunk pablopunk self-assigned this Sep 8, 2017
@niftylettuce niftylettuce modified the milestone: alpha-v1.0.0 Sep 8, 2017
@pablopunk
Copy link
Contributor

That worked, I'll push the fix right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants