Coding Fun Mean Stack MEAN Stack App Part 18 – User Permissions & Roles (CRUD – Create Read Update Delete)

MEAN Stack App Part 18 – User Permissions & Roles (CRUD – Create Read Update Delete)





Source files:

Topics covered in this video:
-User Roles and Permissions
-Editing Users
-Deleting Users

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

15 thoughts on “MEAN Stack App Part 18 – User Permissions & Roles (CRUD – Create Read Update Delete)”

  1. Lungile Madi says:

    David, how come in mainController we pass in userServices as a dependency but in managmentController we dont pass it in, yet we are still able to use userServices?

  2. Rafy sanchez says:

    consider to improve the video quality. the issue is great !

  3. Nate River says:

    Wow Mr. David you are a truly professional, creating this from scratch! how did you do that and memorize all this stuff. Wish you could do tutorials about live graphs and chart using MEAN stack, that would be great

  4. Hi david, please how to add another model with cruds

  5. Hi David,
    I have problem with router.get('/edit/:id') , please help me.
    throw er; // Unhandled 'error' event
    ^
    CastError: Cast to ObjectId failed for value " 5a7daff59f641a04d49e6867" at path "_id" for model "User"

  6. Jerry Bin says:

    anyone add this to github ? thanks 🙂

  7. Test App says:

    Hi David, would you please help me how add to your tutorial code upload file using multer? I am trying to do but I can set multipart/form-data header and my req.file is undefined

  8. Awesome job! this is great, my comment was even featured in this video 🙂

  9. ala qaffaf says:

    Hi David
    I have problem with login. The issue is if the admin edit user's information and I try to login again as user whom edited by admin I can't login again and gives me error in password authenticated, the password immediately change for any new update so what I can do to fix this error Please help meeeeeeeeeeeeeeeeee

  10. babu murari says:

    Hello david, i have added another model for ex vehicle db ,adding values from admin side, retrieving them is getting, but how to delete it like your user delete, how to do api, controller for this type delete.. can u help me with this .. urgent..Thanks in advance

  11. Swaraj Totey says:

    Hi David,
    My code for saving user,
    user.fname = newfname;
    user.save(function(err){
    if(err){
    console.log(err);
    }else{
    res.json({success:true, message: "Name has been updated"});
    }
    });
    I am getting this error on save,
    { ValidationError: User validation failed
    at MongooseError.ValidationError ({Project-path}mongooseliberrorvalidation.js:23:11)
    at model.Document.invalidate ({Project-path}mongooselibdocument.js:1535:32)
    at {Project-path}mongooselibdocument.js:1410:17
    at validate ({Project-path}mongooselibschematype.js:706:7)
    at {Project-path}mongooselibschematype.js:738:11
    at model.validator ({Project-path}mongoose-validatorlibmongoose-validator.js:55:16)
    at {Project-path}mongooselibschematype.js:731:35
    at Array.forEach (native)
    at SchemaString.SchemaType.doValidate ({Project-path}mongooselibschematype.js:711:19)
    at {Project-path}mongooselibdocument.js:1408:9
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    errors:
    { password:
    { ValidatorError: Password should be between 8 and 35 characters long.
    at MongooseError.ValidatorError ({Project-path}mongooseliberrorvalidator.js:24:11)
    at validate ({Project-path}mongooselibschematype.js:705:13)
    at {Project-path}mongooselibschematype.js:738:11
    at model.validator ({Project-path}mongoose-validatorlibmongoose-validator.js:55:16)
    at {Project-path}mongooselibschematype.js:731:35
    at Array.forEach (native)
    at SchemaString.SchemaType.doValidate ({Project-path}mongooselibschematype.js:711:19)
    at {Project-path}mongooselibdocument.js:1408:9
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    message: 'Password should be between 8 and 35 characters long.',
    name: 'ValidatorError',
    properties: [Object],
    kind: 'user defined',
    path: 'password',
    value: '$2a$10$1dlGe7hxLifAi7pzExc4iOgKMeg2/mqlbYYR28g4l88V3Dg99sSJy',
    reason: undefined } },
    message: 'User validation failed',
    name: 'ValidationError' }

  12. Hi david, I would like to edit the logged in user on main page, so I am wondering how would I go on about fetching the username or id of the said user.

  13. Stephen Wang says:

    Hi David, would you please help me to check my application? I have error with "login page" now, THE Issue is "if I login an account and log out immediately then When I tried to login again, the issue comes. it shows ''app.SuccessMsg" which is "user authenticated…….redirect" , and after that I can not enter the any word in the input box and shows an error in console which is"ypeError: Cannot create property 'username' on string ''
    at Object.fn.assign (eval at compile " and by the way, I also can not render the logout.html when logout just directly redirect to the home.html"

    would you please help me to fix these,

    and would please give me a E-mail address or you can send me a E-mail to the address: agentjob421@gmail.com that I can send my application back to you, please help … very urgent, please help, thank you so much

  14. Veli says:

    im new to web development but i was wondering if you're building an restful api?

Leave a Reply

Your email address will not be published. Required fields are marked *