How To Handle Permissions Like A Senior Dev

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 220

  • @WebDevSimplified
    @WebDevSimplified  9 วันที่ผ่านมา +6

    Try Clerk: go.clerk.com/b2b-orgs

  • @Mac501pl
    @Mac501pl 8 วันที่ผ่านมา +94

    I like how over time your channel covers more and more advanced topics. I feel like I've been growing in my career in a similar pace, so you always have me covered! Thank you

    • @xaweeeed33rt5g43wsd
      @xaweeeed33rt5g43wsd 7 วันที่ผ่านมา +6

      you are wrong. What you are doing is consuming precisely targeted ads. This video is nothing more than an advertisement. He didn't even mention free/open source alternatives. Every second of this video is designed to attract you to the clerk's product.

    • @minhaz3193
      @minhaz3193 6 วันที่ผ่านมา +3

      @@xaweeeed33rt5g43wsd the permission logic is the same regardless of what auth provider you use though. You expect to consume his videos for free then complain when he gets someone else to pay him to continue teaching for free.

    • @tfcbhop6380
      @tfcbhop6380 3 วันที่ผ่านมา

      @@xaweeeed33rt5g43wsdso what? The auth process stays the same without clerk and also that’s some great learning material and good explanation he’s done.

    • @isenewotheophilus6485
      @isenewotheophilus6485 วันที่ผ่านมา

      @Mac501pl Me too 😅

  • @elhaambasheerch7058
    @elhaambasheerch7058 8 วันที่ผ่านมา +43

    26:00 , "I am not really that great at typescript", says the guy who is my and many other self taught coders' favourite teacher.
    Take a bow man.

  • @killerpixel2k3
    @killerpixel2k3 8 วันที่ผ่านมา +98

    Great video!!! It's important to note that you have to handle permissions for both the client display AND the database action. For example, if you display the delete button for your own comments and clicking it results in `DELETE /api/comments/123` and someone can find the ID of another comment (maybe by looking at the XHR request for the listing page of comments) and issues their own DELETE fetch request to the other comment, your backend or DB has to also check permissions and not just delete the comment. Postgres can do row-based and column-based policies that makes that a lot easier to do that particular check on the backend.

    • @warrenarnoldmusic
      @warrenarnoldmusic 8 วันที่ผ่านมา +24

      But why would you move authorization logic to the db layer really. A server app layer can handle this comfortably. Unless you share and touch db outside of the app, or are serving client app straight from db eg firebase, i would not advise for that. Db should be kept as simple as possible.

    • @killerpixel2k3
      @killerpixel2k3 8 วันที่ผ่านมา +8

      @warrenarnoldmusic that's why I said either do it on the backend or DB. One over the other and what "should" be done is a preference / philosophical question, making sure a client side request is validated for authorization is not a question, but a requirement.

    • @retakenroots
      @retakenroots 8 วันที่ผ่านมา +4

      ​@@warrenarnoldmusicyou could even consider building a dbase access layer. The server should only use that layer. Any program accessing that dbase should use that access layer. It enables access control to be shared.

    • @codewrangler
      @codewrangler 6 วันที่ผ่านมา +4

      I would recommend a layered approach to authorization. Frontend and backend. Frontend - fetch the role of the user from DB. Then use something like RLS in Postgres to support row-level security. Then write RLS policies for each table that leverages the user roles. In supabase you can do this easily.

    • @fakedoctor7527
      @fakedoctor7527 3 วันที่ผ่านมา +1

      let me made it simpler what this guy says is just do not directly update the db, do check is this from the same user or not

  • @JohnGasper
    @JohnGasper 8 วันที่ผ่านมา +13

    IAM professional here. Great job showing devs solid principals that can be applied to most projects, Clerk or not.

  • @msahu2595
    @msahu2595 6 วันที่ผ่านมา +2

    Amazing 🤩 I have been searching for years for this video. But never find this kind of your where all kind of permission handling discussed in a single video with all advantages and disadvantages. Thankyou for this video 🥳

  • @someguyO2W
    @someguyO2W 7 วันที่ผ่านมา +4

    This is possibly one of the best resources hands down, on the topic.
    You did a great job!

  • @Tszyu01
    @Tszyu01 8 วันที่ผ่านมา +28

    CASL is a great library with many integrations for handling complex decisioning like this

    • @zocky3282
      @zocky3282 8 วันที่ผ่านมา +1

      +1 for CASL

    • @023PrashantSharma
      @023PrashantSharma 5 วันที่ผ่านมา

      +1

    • @023PrashantSharma
      @023PrashantSharma 5 วันที่ผ่านมา

      Initial it is hard to me to work with it but now I now how powerful and simple

    • @zul.overflow
      @zul.overflow 4 วันที่ผ่านมา

      casl team 👊

    • @AlexanderMoon
      @AlexanderMoon 4 วันที่ผ่านมา

      I wouldn't be surprised if Clerk uses CASL internally

  • @juniordev4life
    @juniordev4life 6 วันที่ผ่านมา +1

    Thanks! Great tip. I'm still working on a 20 year old application and rewrite it from scratch. I will use this advice. Top tip! Go forward with more of these practical topics.

  • @ziacodes
    @ziacodes 4 วันที่ผ่านมา +9

    Please do this more often, This is something I would learn everyday.

  • @هواتف-م9ر
    @هواتف-م9ر 8 วันที่ผ่านมา +27

    This guy puts out quality educational content and for free !!!
    Thanks man

    • @paeon
      @paeon 6 วันที่ผ่านมา

      the problem is free, the solution is a paid service, so...

  • @hernanbphb
    @hernanbphb 8 วันที่ผ่านมา +6

    its been 4 min and I already feel the whole video will be worthwhile

    • @StingSting844
      @StingSting844 8 วันที่ผ่านมา

      It will be worthwhile if you're a beginner

    • @hernanbphb
      @hernanbphb 8 วันที่ผ่านมา +3

      ​@@StingSting844 yeah I dont think seniors are watching videos on youtube on how to do auth, thanks for pointing the obvious

  • @WhispersatDusk-dy9hy
    @WhispersatDusk-dy9hy 3 วันที่ผ่านมา

    As someone who works on a permissions team, glad to see some coverage about it. Not talked about much but is crucial to get right. And try not to roll your own authorization unless your companies unique demands call for it.

  • @TheStallion1319
    @TheStallion1319 7 วันที่ผ่านมา +6

    more in this topic please , people usually skip this part and use ready solution, but building it up from scratch and understanding this topics is what differentiates a good dev from the others

  • @Gabifuertes
    @Gabifuertes 7 วันที่ผ่านมา

    15:42 This is what I've come up with on my own and have used for quite a bit. It's great to have someone show me the limitations and then how to overcome them. Thank you!

  • @jareddiscipio1768
    @jareddiscipio1768 8 วันที่ผ่านมา +8

    Another great tutorial from one of the best content creators on TH-cam!!! Keep it up man

  • @ClarkeDesign
    @ClarkeDesign 8 วันที่ผ่านมา +1

    I've just written a system using CodeIgniter and implemented security using Shield - which is there Role Based Access Control system. Very good and made like so much easier as things changed during development. Using if statements like "can a use do this" made development and security so much easier.

  • @karsh001
    @karsh001 5 วันที่ผ่านมา

    Lovely vid! First implementation is generally called CRUD, Create Read Update Delete. It's generally better to keep to the standard. The standar for all this called NIST INCITS 359-2012. My personal fav product for ABAC is called Axiomatics. Easy to work with both as dev and admin.
    The whole point of ABAC from an enterprise view is to place the complexity where it belongs - at the business level. A chief enterprise architect may at any time be responsible for several dev projects. Dealing with different authorization models for every system becomes needlessly complex for every one. From this perspective, devs with ABAC skills become very valuable.

  • @frikkie
    @frikkie 8 วันที่ผ่านมา +5

    Using Bitmasking makes it even easier. That also solves the problem of permission inheritance from various roles - that way you only end up with one permission set per user, don't have to work with roles directly.

    • @milimilutinovic835
      @milimilutinovic835 5 วันที่ผ่านมา +1

      Could you please elaborate on this interesting suggestion

    • @frikkie
      @frikkie 5 วันที่ผ่านมา

      ​@@milimilutinovic835 A bit difficult to explain in a comment, but let's try.
      Think of bits as permission flags. For instance, let’s say we have four permissions: Create, Read, Update, and Delete (C, R, U, D). These can be represented in binary as 1111, which equals 15 in decimal. A bit for each permission.
      If a user has all four permissions, you store the value 15 next to their name.
      To check if a user has a particular permission, you can use bitwise operations. Assign a unique decimal value to each permission:
      {
      create: 1,
      read: 2,
      update: 4,
      delete: 8
      }
      Now, to check if a user has the "update" permission, simply do:
      userPermissions & systemPerms.update
      This operation returns a non-zero value if the user has the "update" permission (since bitwise AND compares corresponding bits and returns a match if both are set).
      To avoid running out of bit values, group permissions into categories:
      {
      homepage: { seeBanner: 1, clickButton: 2 },
      users: { create: 1, update: 2, read: 4, delete: 8, allocate: 16 }
      }
      Now you can store decimal values for each category:
      {
      homepage: 1,
      users: 31
      }
      When a user has multiple roles, you combine their permissions by adding the respective role values together.
      Bitwise operations allow you to modify permissions:
      Add permission:
      userPerms.users |= systemperms.users.delete; // Adds the 'delete' permission
      Toggle permission:
      userPerms.users ^= systemperms.users.delete; // Toggles the 'delete' permission
      Remove permission:
      userPerms.users &= ~systemperms.users.delete; // Removes the 'delete' permission
      Summary of operators:
      |= (OR assignment): Adds the specified bit to userPerms.users. If it’s already set, no change occurs.
      ^= (XOR assignment): Toggles the specified bit in userPerms.users.
      &= ~ (AND with negation): Removes the specified bit from userPerms.users.
      This approach efficiently manages permissions and scales well for larger applications with many roles and permissions.

    • @frikkie
      @frikkie 5 วันที่ผ่านมา

      ​@@milimilutinovic835 Think of bits as permission flags. For instance, let’s say we have four permissions: Create, Read, Update, and Delete (C, R, U, D). These can be represented in binary as 1111, which equals 15 in decimal.
      If a user has all four permissions, you store the value 15 next to their name.
      To check if a user has a particular permission, you can use bitwise operations. Assign a unique decimal value to each permission:
      {
      create: 1,
      read: 2,
      update: 4,
      delete: 8
      }
      Now, to check if a user has the "update" permission, simply do:
      userPermissions & systemPerms.update
      This operation returns a non-zero value if the user has the "update" permission (since bitwise AND compares corresponding bits and returns a match if both are set).
      To avoid running out of bit values, group permissions into categories:
      {
      homepage: { seeBanner: 1, clickButton: 2 },
      users: { create: 1, update: 2, read: 4, delete: 8, allocate: 16 }
      }
      Now you can store decimal values for each category:
      {
      homepage: 1,
      users: 31
      }
      When a user has multiple roles, you combine their permissions by adding the respective role values together.
      Bitwise operations allow you to modify permissions:
      Add permission:
      userPerms.users |= systemperms.users.delete; // Adds the 'delete' permission
      Toggle permission:
      userPerms.users ^= systemperms.users.delete; // Toggles the 'delete' permission
      Remove permission:
      userPerms.users &= ~systemperms.users.delete; // Removes the 'delete' permission
      Summary of operators:
      |= (OR assignment): Adds the specified bit to userPerms.users. If it’s already set, no change occurs.
      ^= (XOR assignment): Toggles the specified bit in userPerms.users.
      &= ~ (AND with negation): Removes the specified bit from userPerms.users.
      This approach efficiently manages permissions and scales well for larger applications with many roles and permissions.

    • @XiangWeiHuang
      @XiangWeiHuang 3 วันที่ผ่านมา

      ​@@milimilutinovic835 consider a website with only one page, and the permission system controls who can read that page. We can write the permission data as a bit, if they can read it's 1; if they can't it's 0.
      Now this page got CRUD, 4 functions. Similar idea, we can have 4 bits to say this user can create but not others (1000); this user can read and update but not create nor delete (0110).
      By this way, instead of designating what role can do what, we can "stack" the roles easily. If a user has two roles: 1000 and 0110, then depends on your design, either he has privilege of 1110 or 0000, they can both be easily calculated thanks to bit masking.
      In C# this is abstracted(?) into Flags, in wrongly simplified way it's like enum but supports OR. if (UserRole.Admin | UserRole.Peasant), etc.
      Much simpler than bunches of booleans, as once frontend and backend promised upon one same chart of flags (i.e. which bit is needed for user to read this page), the value can be passed as simple numbers and then go on with the logics even more easier.

  • @mrsvilkic
    @mrsvilkic 8 วันที่ผ่านมา +2

    Thank you so much! I was just implementing RBAC on a huge project today, but Im going to change it to ABAC!

  • @justinhoward6384
    @justinhoward6384 8 วันที่ผ่านมา +1

    This is awesome because you helped me get a job, and now you're helping me keep it!

  • @T1Oracle
    @T1Oracle 6 วันที่ผ่านมา +1

    User -> Action -> Resource
    User = Id
    Action = CRUD
    Resource = Type, Id
    Role = Action + Resource
    Roles are a simplification.

  • @omarbitar2414
    @omarbitar2414 7 วันที่ผ่านมา +1

    Loving the best practice videos you've been pushing lately. Can u make a video on which architectural design patterns to use for reactive frameworks like vue and react? Like mvc and mvvm?

  • @deucebigs9860
    @deucebigs9860 7 วันที่ผ่านมา +1

    What perfect timing for me that you put this video out. Thanks!

  • @fadhilinjagi1090
    @fadhilinjagi1090 2 วันที่ผ่านมา

    I like Bouncer authorization system from Adonis. It's the most straightforward one I have ever seen

  • @learn-with-khaalid
    @learn-with-khaalid 8 วันที่ผ่านมา +1

    Wow, Thanks Web Dev Simplified Very Helpful please Continue Making Videos For advanced Topics

  • @cherubin7th
    @cherubin7th 8 วันที่ผ่านมา +8

    This came just in time!

    • @Bayzon08
      @Bayzon08 8 วันที่ผ่านมา

      I was going to implement security on my api today, this was a god sent

  • @rijumamdq
    @rijumamdq 7 วันที่ผ่านมา

    Great video and I love the last approach. Thanks for the tutorial and for all the quality knowledge you share on the channel.

  • @yurisich
    @yurisich 7 วันที่ผ่านมา

    This is a good example of using exhaustive type systems to remove stringly-typed APIs. Very useful.

    • @T1Oracle
      @T1Oracle 6 วันที่ผ่านมา

      Imagine how much better it would be in Rust! 😉

  • @maciekwar
    @maciekwar 3 วันที่ผ่านมา

    typescript is such a blessing :) this is pretty nice, but this has one assumption, when you say what roles user has, you are giving positive authorization for a user, this is allow authorization, there is also negative case, deny authorization, that takes precedence over allow, and if you have multiple roles, you can setup in a way that if you have role hierarchy that is not additive, meaning each lower role is not a subset of higher role, then deny will be handy, you can add authorization to a user, for a role this is usually allow, but also for a permission, this can deny something, this way you can do role_level1 role_level2 role_level3, and level2 can do everything that level1 and something else, but level3 can include level2, and level1 and something else, but also exclude something that only level1 and level2 can do. its not my invention, some businesses work this way.

  • @royz_1
    @royz_1 8 วันที่ผ่านมา +8

    Beware clerk users!! public metadata in clerk is limited to 8KB which isn't enough for even a medium sized production application. We implemented ABAC (attribute based access control) using clerk's public metadata last year and we hit the ceiling a couple of months ago. Clerk is so buggy that instead of not letting you store data which exceeds the limit, it would put the client in an endless refresh loop. A pretty terrible oversight.

    • @KWerder92
      @KWerder92 8 วันที่ผ่านมา

      Just curious, what data did you put in there? I mean 8kB is huge isnt it? I guess not only stuff related to ABAC?

    • @royz_1
      @royz_1 8 วันที่ผ่านมา +1

      @@KWerder92 mainly an array of features and routes. 8kb is not that much when storing JSON.

    • @PureDizzi
      @PureDizzi 8 วันที่ผ่านมา +3

      Real devs make their own clerk

  • @sathishkannan6600
    @sathishkannan6600 6 วันที่ผ่านมา +2

    This is some good stuff. I was facing a similar problem in work. Thank you.

  • @franklinsecretario3862
    @franklinsecretario3862 6 วันที่ผ่านมา

    Looking forward to more content like this! Great video, by the way-very informative.

  • @0.amonymous
    @0.amonymous 8 วันที่ผ่านมา +23

    I feel like clerk overcomplicates everything here, seems much easier to just create the permission checking function ourselves (btw I just found CASL it seems really simple to use and it's free). I think this channel is great, but this video specifically is WebDevOverEngineered. And clickbait. I clicked expecting to see best practices on Permissions and how to structure them, instead I got baited lol. Didn't really go into depth on how to structure it yourself.
    Clerk is a third party with data limits. Also this video is clickbait. It's a sponsor. It's a clerk review. Total click bait. It's not a video focused on permissions, it's about Clerk... Also I totally missed where he said it's a sponsor. I know he said it, but I didn't see/notice him saying it.

    • @abdarker1043
      @abdarker1043 8 วันที่ผ่านมา +3

      plus who uses a 3rd party for this? this is suitable for school projects

    • @0.amonymous
      @0.amonymous 8 วันที่ผ่านมา +3

      @abdarker1043 I swear the clerk implementation details he described makes no sense to me. Why the hell would I do all that. Why use a lib that just checks keys inside User/Roles from a database, and has some obscure implementation steps and functions. Simple DB Relations with tables:Users/Companys/Roles/Perms already do all that.

    • @theodorealenas3171
      @theodorealenas3171 8 วันที่ผ่านมา +2

      I was sure he was about to raw dog the implementation so I was confused he talked about Clerk.
      Btw does that UI with the JSON have to do with Clerk? If so, that's a plus

  • @arztv1422
    @arztv1422 4 วันที่ผ่านมา

    Hi Kyle,
    Love your content! One minor suggestion: could you make the code editor and browser output colors consistent (both black or white) in your future videos? The current contrast makes it hard to watch.

  • @Aprev
    @Aprev 8 วันที่ผ่านมา

    Thanks Kyle! The video is phenomenal! So professional, great work!

  • @dreamsachiever212
    @dreamsachiever212 8 วันที่ผ่านมา +2

    loving these content lately. thanks.keep cooking

  • @Joey-o7p
    @Joey-o7p 8 วันที่ผ่านมา +4

    I love senior dev contents ~

  • @Imk_Aslam
    @Imk_Aslam 7 วันที่ผ่านมา

    Quality content appreciates your efforts man.

  • @AmirLatypov
    @AmirLatypov 4 วันที่ผ่านมา

    Incredible work! A few days ago I looked for existing libraries for this type of permissions, but all of them were complicated and not so easy to use.
    Do you want to make an npm package?

  • @matthias5317
    @matthias5317 8 วันที่ผ่านมา +1

    Great Video and imho a really very clean solution regarding permission management. Thanks
    I have some concerns with Clerk. Maybe you could address them in a future video - it feels weird to store the most personal data with a 3rd party - and there are obvious GDPR concerns. Also what happens if clerk decides to shut down. - I know you have a paid cooperation with them - but could you do a video on those topics from a developer perspective. Maybe there are solutions for those issues. Working in the EU - with larger organisations, that share those concerns - it would be good to have answers from a developers perspective.

    • @LetrixAR
      @LetrixAR 7 วันที่ผ่านมา

      You only store username, email (for login, password reset) and, in this case, roles. You rarely need to give a 3rd party auth service more data than that.

  • @droogielamer
    @droogielamer 3 วันที่ผ่านมา

    You should also support "scope", so that users can delegate part of their permissions to third party (at least if you provide an API or something similar).

  • @tonyg_nerd
    @tonyg_nerd 8 วันที่ผ่านมา

    Another great vid Kyle. Always tough to see your stuff on phone with small font but usually fine to zoom the device for detail. Please try to minimize size of less relevant visual artifacts, perhaps including your face. 😂

  • @danieladinugroho673
    @danieladinugroho673 8 วันที่ผ่านมา +1

    Hi Kyle, thank you for this tutorial. I learn a lot from your tuts and saving to enroll on your course. Just wondering, why you choose to use {actions:resource} but not the other way around? I am thinking {resource:action} would be more readable and we can group them easily. We can have {resource:*} as well to allow all actions on the resource.

    • @WebDevSimplified
      @WebDevSimplified  8 วันที่ผ่านมา +1

      Either works. I find that it reads more like English to say create:thing than to say thing:create

  • @nitay2870
    @nitay2870 2 วันที่ผ่านมา

    Thank you so much for everything, can you please continue also with more video with javascript :)

  • @ai-generated-contents
    @ai-generated-contents 7 วันที่ผ่านมา

    removing clerk, everything said here, is what I thought I invented for a system. glad that what I did is actually a real-world practice.

  • @Greedygoblingames
    @Greedygoblingames 8 วันที่ผ่านมา +1

    Sage advice. SAP has been doing it this way for decades

  • @antidegenerates7449
    @antidegenerates7449 8 วันที่ผ่านมา

    Best dev content on TH-cam

  • @DarrylHebbes
    @DarrylHebbes 8 วันที่ผ่านมา +2

    Love the masterclass episodes!

    • @WebDevSimplified
      @WebDevSimplified  8 วันที่ผ่านมา +2

      Thanks. I have really enjoyed making them!

  • @grim.reaper
    @grim.reaper 8 วันที่ผ่านมา +3

    😭😭😭😭 thank you so much for making this

  • @ADITYACHEBROLU
    @ADITYACHEBROLU 7 วันที่ผ่านมา

    Great content! Need more videos like these❤

  • @dgdev69
    @dgdev69 8 วันที่ผ่านมา

    Bro never fails to deliver.
    Would love to see oauth, jwt token for viewing images.

  • @AbhishekYadav-ch2mn
    @AbhishekYadav-ch2mn 8 วันที่ผ่านมา

    When will you start working on a MERN microservice or microfrontend architecture? All your previous projects have been monolithic. Please consider creating an e-commerce application using a microfrontend and microservice architecture

  • @harshitpant07
    @harshitpant07 8 วันที่ผ่านมา +6

    need masterclass on how to set hair like you

  • @kousseilameniche6246
    @kousseilameniche6246 8 วันที่ผ่านมา

    Exactly when i needed it! thanks goat

  • @code-env
    @code-env 3 วันที่ผ่านมา

    The video was really nice!
    can you make a video on how to use the clerk webhook directly?

  • @dave6012
    @dave6012 8 วันที่ผ่านมา

    ABAC is pretty nice. I’ve been pondering how gdrive does it lately. However, the final example does not implement the generic resource-user-role table approach, it is the uber copy/paste approach 😢

  • @ethiocode298
    @ethiocode298 8 วันที่ผ่านมา +1

    32:46 why user "3" has update and delete permission even though blocked by user "2"
    edited: I thought user "3" should be blocked from every access user "2" provides...
    Nice implementation tho... I was doing some .Net roles and permissions stuff on the backend and this is lit

  • @ManasMadrecha
    @ManasMadrecha 6 วันที่ผ่านมา +1

    Thanks. Could you add a video on how to store the roles & permissions (especially the Functions for the resource itself) inside Database?

    • @WebDevSimplified
      @WebDevSimplified  6 วันที่ผ่านมา

      I don't plan on expanding this to storing in a DB. If you wanted to store this in a DB you would need to not use functions and instead store your data in a form like JSON which you could then use to do checks with. For example you could store something like { authorId: "eq({userId}" } in JSON to signify the authorId must equal the current user's id.

    • @ManasMadrecha
      @ManasMadrecha 6 วันที่ผ่านมา

      @WebDevSimplified yes, I like this approach. That can work. Thanks for this informative video 😊

    • @daviddomkar
      @daviddomkar 2 วันที่ผ่านมา +1

      Take a look at CEL expressions. You could store code in the form of these expressions in the database and then evaluate them when the actual permission check happens.

  • @KishanOza-q3f
    @KishanOza-q3f 8 วันที่ผ่านมา

    Thanks Great video!! we wanted to use clerk as well but the problem with that is we started our project with manual role based auth. we are using trpc, prisma and zenstack. If you can make a video around these stack with clerk that would be very helpful.

  • @marcialabrahantes3369
    @marcialabrahantes3369 3 วันที่ผ่านมา

    3:50 I'd make those inner arrays into maps - `"permission": true` for faster checks 😉

  • @baileysli6235
    @baileysli6235 8 วันที่ผ่านมา

    3:55 change arrays into set. It's require more memory, but I'll check these permissions very often, so it's better avoid extra iterations

    • @theodorealenas3171
      @theodorealenas3171 8 วันที่ผ่านมา

      I think it's about 3000 elements where it starts to be faster to get the from a hashmap. Below 3000 elements itsfaater to iterate through an array and check each element. In some contexts it's 3000, in others 10000

  • @AdityaRaj-lj5wf
    @AdityaRaj-lj5wf 8 วันที่ผ่านมา +2

    Hey Kyle, there's an extension of vs code that hides .env values for recording purposes.
    Hope it helps

    • @WebDevSimplified
      @WebDevSimplified  8 วันที่ผ่านมา +1

      Thanks for letting me know, but I have no issues showing my .env file since I always delete my keys after recording a video.

  • @supremeoverlord1
    @supremeoverlord1 8 วันที่ผ่านมา +1

    Heya Kyle 😎. Love your contents man

  • @miervaldis42
    @miervaldis42 4 วันที่ผ่านมา

    Can you make a playlist with all of your "Like A Senior Dev" videos please ?

  • @VectorNodes
    @VectorNodes 7 วันที่ผ่านมา

    I remember before understanding access control I accidentally over engineered my way up to inventing a terrible abac. It wouldn’t surprise me at all if that site is still using most of my newbie code haha

  • @alirezamohammadi9691
    @alirezamohammadi9691 4 วันที่ผ่านมา +1

    bro youtube is missing your zustand crash course please consider it for your next video

  • @MrVipulLal
    @MrVipulLal 4 วันที่ผ่านมา

    Thanks! Really good video.

  • @MirkoVukusic
    @MirkoVukusic 2 วันที่ผ่านมา

    Very interesting video. But I'm not sure whats the best practice to design backend DB queries to take this into consideration. Example has hard-coded data, which is the same as fetching all records from database and filtering it based on roles. But this is not optimal for DB querying. In example, if my users are split into departments, and my user has permissions only to view users from his own department, and he requests the list of users from backend... I need to add to query something like "where departmentId = user.departmentId". Of course, I can hard-code this into API requst (get user's departmentId from auth session data), but is this good practice? It seems I'm just spreading permissions data configuration from a single place (permissions file/db) into code.

  • @GuildOfCalamity
    @GuildOfCalamity 8 วันที่ผ่านมา

    Great video, but can you cover what extensions you have running in VS?

  • @msalih
    @msalih 8 วันที่ผ่านมา

    I think RBAC is Ok for relatively simple projects. Others are including the sponsored one is for huge projects

  • @Neeeeeeeko
    @Neeeeeeeko 7 วันที่ผ่านมา

    Banga vid my dude

  • @utkarshseth3082
    @utkarshseth3082 8 วันที่ผ่านมา

    This is really good one i watched full video 🔥🔥🔥🔥

  • @roodood
    @roodood 8 วันที่ผ่านมา

    In Rails I usually use the cancancan library for exactly this type of stuff. The problem usually comes when I need to expose the permissions for the client when making an SPA. How does Clerk do that? Do they serialize the permissions somehow, or is it just an extra http call everytime you check a permission on the client?

  • @bluegam3r_975
    @bluegam3r_975 8 วันที่ผ่านมา

    I was just about to implement this. Nice

  • @sebastianjulonchamana2987
    @sebastianjulonchamana2987 8 วันที่ผ่านมา

    this is gold, thanks!!!!

  • @TheCodebookInc
    @TheCodebookInc 7 วันที่ผ่านมา

    I created a Permission manager class and have added the static methods in it which works perfectly fine for actions I m driving the method which I want to calls and get the value which is way a lot easier without depending on third party packages 😅

  • @munna5553
    @munna5553 8 วันที่ผ่านมา

    Kyle is not teacher he is content creators 😊😊

  • @thatsalot3577
    @thatsalot3577 8 วันที่ผ่านมา

    you taught me to do permissions like that 0:01 few years ago 😆

  • @alreadynuked
    @alreadynuked 5 วันที่ผ่านมา

    What do you do/use to sort your code to make it look better and align?

  • @mohammed-i786
    @mohammed-i786 7 วันที่ผ่านมา

    Awesome video! Could you please also make a tutorial on implementing ABAC with node.js?

    • @WebDevSimplified
      @WebDevSimplified  7 วันที่ผ่านมา

      Everything in this video is applicable to Node.js as I used no React specific features.

    • @mohammed-i786
      @mohammed-i786 6 วันที่ผ่านมา

      @@WebDevSimplifiedRight, but a tutorial showing ABAC with database integration would be really helpful! Thanks!

  • @clinto_abraham
    @clinto_abraham 8 วันที่ผ่านมา

    Hey, could you make a video which handles server side rendering for react other than the framework such as next, etc. Like to learn how to make use of custom ssr react, maybe with vite initial start up and deploy on ec2

  • @developmentroselino
    @developmentroselino 2 นาทีที่ผ่านมา

    wow new guitar ! is that 7 strings ?

  • @ajiteshmishra0005
    @ajiteshmishra0005 2 วันที่ผ่านมา

    Could you please create a Project by watching and checking it with a Figma file having any design and upload that video to this channel so that we learn & get benefits?
    We need to learn the strategy to complete a project fast through Figma.

  • @vivianliu5011
    @vivianliu5011 4 วันที่ผ่านมา

    maybe I am wrong, but at 32:52, when use 3 is blocked by user 2, it doesn't have view permission, how it still has update and delete permission?

  • @SheeceGardazi
    @SheeceGardazi 8 วันที่ผ่านมา

    another banger of a tetorial

  • @iury664
    @iury664 8 วันที่ผ่านมา

    can u explain the typescript behind the keyof and typeof in the ROLE constant ?

  • @minidragonlady
    @minidragonlady 7 วันที่ผ่านมา +1

    Next episode: Super ultimate pro max ultra senior ?

  • @jondycz
    @jondycz 8 วันที่ผ่านมา +1

    35:00 Basically everyone who flexes with typescript 😬

  • @whoman7930
    @whoman7930 8 วันที่ผ่านมา

    Next video idea, user-defined order for rows in SQL.

  • @alvarorodriguesschmidt8507
    @alvarorodriguesschmidt8507 8 วันที่ผ่านมา

    It's right on time.❤

  • @kerrykreiter445
    @kerrykreiter445 8 วันที่ผ่านมา

    Thanks Kyle…..more “brain dead easy” content please!😂

  • @KhalidKhan-xq5xp
    @KhalidKhan-xq5xp 8 วันที่ผ่านมา

    Great video !!!

  • @codeSurvivor
    @codeSurvivor 8 วันที่ผ่านมา

    With this approach, if we have multiple front-ends (mobile app, desktop app) we would have to duplicate and maintain the permissions setup in each of them. Shouldn't this be centralized in the server with an api endpoint to which you send the subject, action, resource and any extra data, so it returns whether the user is allowed or not?
    Regarding security, just as a reminder, this is front-end permissions just to show or not buttons, full sections or whatever which is not secure by definition. The real security controls should always be implemented at server level (or db?)

  • @arthoer
    @arthoer 7 วันที่ผ่านมา

    A common case is that Roles are unknown, as users can create their own and assign permissions to each role. In other words, there is no point in handling roles, besides from a UX perspective?

  • @Invisible_Joy
    @Invisible_Joy 8 วันที่ผ่านมา

    Very helpful 👍🏻

  • @darealmexury
    @darealmexury 6 วันที่ผ่านมา

    It's as if you knew exactly what I'm currently working on

  • @dheerajs2838
    @dheerajs2838 7 วันที่ผ่านมา

    this is such a great video ..

  • @jason_v12345
    @jason_v12345 6 วันที่ผ่านมา

    Cool, but permissions aren't always simply about what action can be done on a resource. They can be much more complicated, like how many of something can be done or for how often or at what times, etc. But the basic ideas is to define a Permissions object in addition to the usual Role.

  • @roeiohayon4501
    @roeiohayon4501 6 วันที่ผ่านมา

    One thing I don't see with you solution is how does that scale? Let's say you have hundreds of roles, and thousands of permissions, do you define a rule for each action on every resource in your system? I'd say another logical approach is to go with the RBAC approach, but just add scoping to it. Of course it wouldn't be as flexible, but you'd at least be able to dynamically add permissions and assign users to them, even from within your application, but I don't see how you'd do that with the last approach you gave.

    • @WebDevSimplified
      @WebDevSimplified  6 วันที่ผ่านมา +2

      This system is specifically meant to scale to incredibly large numbers of permissions and roles. Yes you would need to define specific rules for each role/action, but you can also create helpers that make this easier (for example having an "all" key that gives a user permissions for all actions on a resources, or grouping resources to make assigning actions easier)

    • @roeiohayon4501
      @roeiohayon4501 6 วันที่ผ่านมา

      @WebDevSimplified thank you for this video and replying!