Great video as always :) One small tip for adding methods from a class to the interface: You can press Ctrl + . on the method name and choose "Pull up to Interface X.."
I love your vids Tim! Love them, love them love them.. they are teaching me superfast as no book could ever do to me. I get the advanced topics because you are a great and very experienced teacher with many insightfull hints and tips!! (enough with the praises :)) I would love to see a video on topics about, 'So I made an mvc website and how do I publish it'. What do you need from your hostingprovider, which files to transfer etc etc. The pitfalls and perils of publishing an mvc site with database, the whole shebang.
Hey Tim, Thanks for the great videos. Just a shortcut to move lines up and down, and you did the swap of rows near1:00:00 for RemoveSelectedRole(), you could simply do Alt up-arrow to swap up, and Alt down-arrow to swap down. Cheers
Hi, Tim Thanks for this excellent tutorial. Regarding to the naming convention, I noticed that in the SellsView, the selected item in Cart was set as SelectedItem="{Binding SelectedCartItem}, and Cart ListBox was named as "Cart". So for the UserRoles ListBox, I used SelectedItem="{Binding SelectedUserRolesItem}, it still worked. we don't need to change to SelectedUserRole. Best reards
I don't remember why I did it that way in the SalesView (I assume I had a reason) but with Caliburn Micro, you can use just the name and bind it. You don't need to do the manual binding.
@@IAmTimCorey By testing, I think the prebuild binding rule for selected item is "{Name}s" --> "Selected{Name}". The manual binding is for customized naming :)
Hi Tim, did you know that when you copy code-lines they are all stored in a clipboard ring? When you want to paste one of these lines you can use Ctrl+Shift+V and then select one of the lines you copied before. So you don't need the notepad anymore. :-)
I did and that's a nice feature. I also use Win+V to use the Windows clipboard ring but I'm cautious not to use either on camera since I also copy passwords and other sensitive pieces of data and I don't want them showing up on video.
The LoadRoles method doesn't need to be async! You can load the roles in the OnViewLoaded event and cache them. You don't need to read them every time when editing users and roles.
@@erikvolger5631 Yes, you are right. I just pointed to this because in the video there was a little confusion how to do this, so i say .GetAwaiter(); Thats all.
Hi Tim! First of all I really enjoy your content (not only this series but your content in generel). The quality of your videos is beyond comparison and your teaching style is absolutely excellent (many university professors could learn a great big deal from you) . Out of curiosity why did you use 'SelectedUserRoles.IndexOf(role.Value) < 0' at 51:41 and not the 'Contains' method? To me it would seem more intuitive to read the if statement with 'Contains'. Is there any specific reason for your choosing?
I found an interesting (should be pre-built) feature in this video 1:00:00. The Remove function will call setter of selectedItem with value null, thus we should call Add before Remove to avoid add a "null" :D
Awesome video series. Working my way through. I am having trouble with adding and removing roles. Putting a break point in the Api UserController I see it executing the AddToRole and RemoveFromRole methods with the expected parameters, but when I check my EFData tables, no changes are made to the roles. Any suggestions?
@@IAmTimCorey Thanks you for the advice. Using that I found a suggestion on stackoverflow to add the context.SaveChanges() method after making the changes and it works as expected!
Thanks for your great vids Tim. What architecture would you say this is? 5-tier architecture? In that case what does the Business Layer correspond to ?
It is roughly 3-tier, but it doesn't really fit into any neat box. That's the nature of software development - we create these clean diagrams of architecture, but that's not how the real world works.
for some reason i could not just do SelectedItem="SelectedUser" i had to add {Binding SelectedUser} Maybe i have done something wrong? eitherway using Binding SelectedUser works fine.
About the non-awaited call, How about calling NotifyOfProperyChange at the end of the load method. The end result is that the role list gets populated nonetheless. (In a worst-case scenario, it might happen with a delay.)
@@IAmTimCorey @53:00 The Calling of async LoadRoles() without awaiting. You said that you are not quite happy with it. What I'm saying is that it doesn't really matter if it's awaited or not.
so my LoadRoles isn't activatating properly, I think it's because it's an async call, and I'm not awaitng it in the property like you had said early on in the video. I was just wondering if it is because I'm not calling an await (which I can't do in a propfull) Thank you Tim for the hard work on this project. I'm using this project to help me learn and get a job in the IT department of my work. They already have a program they use but it's shitty and they want to replace it.
Strange, so my code works, but it won't show the Manager Role, but if I remove the roles currently added I can re-add them back on... so Manager won't load from the Database, but the Cashier and Admin Roles will populate if removed from the user. I still think it's an await error?? because I'm updating the roles after the fact while everything is running it's allowing it to populate the list, but the Manager role will never be populated because it's not reaching that far due to await/async?
And then doing more testing lmfao, I hand populated the DB to give myself the Manager role and when I remove it I can re-add it, but for example, I ran my application, removed the Manager role from myself, closed the application and re-ran it. Doing so I only had Cashier and Admin roles which is fine, that works thats what I was hoping would happen, but again the Manager role disappears again like aforementioned.
A bug I noticed (at least with my version). If you attempt to to access "Users" without first logging in, you will be rejected due to lacking authentication. But then, there is no way to log back in, since I'm left with a blank screen and the menu options for "File" and "Users" I fixed this on the ShellView by making the Account menu item always visible, and added a new Sign In option that was always present. I moved the collapse check to the Sign Out option only.
Hello Tim! Thanks for the video. Everything was working fine as of now. But AddRole method started failing throwing the exception "Not found". Same method works fine from Swagger!! but not through code.
What if you want to set the authorization role dynamically? If the system role is configurable than you can't use hard coded Authorize(Role="roleName") .
You can't use dynamic roles with that statement. You would need to do it a different way. However, using a static role is extremely common. In fact, it is the same pattern we see in servers like Exchange Server and others. You assign a role to a task and then you put people into that role or remove them from that role. That's where the dynamic security comes in. People take on roles. We don't typically re-assign roles to tasks.
@@IAmTimCorey Thanks. I know its very common. I just want to know how people handle such scenarios where role is configured dynamically and you want to build a role based approval tree that will allow to configure dynamically.
Hi Tim, I am so happy cause I have been following this tutorial untill this video. As you say, we are going to move to .NET core in the next video. But, I do not have any basic skills in .NET core. Is it ok if I continue? or I should learn the basic first?
Hi tim! Thanks for the videos, i'm looking forward for the big upgrade on Nov 4th! I have one question. If i want to add another user ( just email, first name, last name), i had to add it directly to my sql database on "TRMData" -> "Tables" -> "dbo.User" or i can create an account on swagger? Maybe it's a different answer or none haha. Will the upgrade on .core have a menu option to create users?
Hi Tim! Its me again ;-) Spent som time searching for an error in my typo. I named the combobox "AvaliableRoles" therefore CM was not able to bind to this control. However: If I would have used listitems="{Binding avaliableRoles}" instead of the implicit "by naming convention" binding, Visual Studio would have told me about it in the XAML Binding errors window.... Is there a way to get those binding errors by wrong type resolved even if you use CM? I could not find anything about that. Do you know a workaround? But maybe there is no need for it sincs CM is no longer supported ;-( Regards, Sebastian
That is the downside of convention-based binding. I don't know of an easy way to get those errors, since they aren't really set up for binding. Otherwise, you would get an error if you named a control but didn't have a property/method named that as well.
@@IAmTimCorey Hi Tim, meanwhile I have found a solution, I missed PropertyChanged Event, because I forgot, that the IBindingList get notified about changing the references of the content, but not the properties themselve. I have created a UserDisplayModel, so that I even could clean the UserModel. Here you can see the Models and how I convert them in LoadUsers(). github.com/CoderboyPB/Pocher/blob/master/foo.cs
@@IAmTimCorey but it works, i have both version of this expression, and right now version with lambda is commented. You can rollback to this video commit and make this change and you see no difference in work of application.
Hi Tim I love your videos. I am one of your big fan. I need your help in one of the topic can you please please help me .I was trying to unit test one of my methods and it had dynamic parameters of dapper I could not find how to mock it. can you please make a video on how to unit test them. I had to change the whole flow because of that which other wise I would have had very generic method in Data access layer.
Tim, Do you have to save the user permissions in a database? I am trying to add permissions but when i try to create roles and add them it doesnt work. Code: //This Creates the role administrator and adds the user to this role Roles.CreateRole("Administrator"); Roles.AddUserToRole($"{aunthenticatedemployeeid}", "Administrator"); Do you any idea on this and why you cant set a role in code? Also if a database is needed then how does it pass the user and permissions around?
You can set this in code and I do cover doing that at some point. As for passing it around, I'm not sure I am understand what you are asking. We will cover using permissions more in the future, including showing how to limit access based upon roles. Maybe that will help.
IAmTimCorey by passing it around i mean passing it similar to a method signature. For example i have two methods in my controller if i set the user permissions in code with out saving to a database i would theoretically have to pass the permissions around to each method i want the user to have access too. I was reading more and think maybe adding permissions in the cookie instead but dont know if thats the best practice. The code i posted wont allow me to create a role and thats what’s annoying. Do you have a video on how to set up your webconfig to set user permissions and if you want to allow a user to connect to multiple dbs. My issue is i have 5 different databases im interfacing with and need to set permissions to allow all users to do crud operations but just restrict the visibility of certain pages with out saving permissions i mean i know i can create a permissions table but i just fell that might be more overhead then needed do you have any thoughts on this? Thanks 😊
Tim, how do you propose we authorize users at an enterprise level where a pool of roles may be assigned uniquely across many offices, customers, projects, and more. I've struggled with this problem for years now and I am curious if you have a design for this situation. Example: Roles = Engineer, Engineering Manager, Sales Associate, Sales Manager Offices = San Francisco, New York, Texas Customers = Customer1, Customer2, Customer3 How can I explicitly assign users to these roles in a intuitive and configurable way?
Great video, Tim! Did you make a follow-up yet where you explain how to get it to refresh and remove the role (Manager) from the left pane display that you just removed using the controls? @1:10:25 I'm having this same situation in an ASP.NET Core app using Identity and have a UI to add new Claims to Users, and I have to logout/login to see those additions/deletions of a Claim to a User in a "User Details" table in the UI--is this an Identity thing?