Umbraco-CMS
Umbraco-CMS copied to clipboard
Content app for user groups & users
While we already have content apps for Content, Document Types, Media, and Members. I think we should also have one for Users and User Groups.
Why? Well, we sometimes have some special permissions in our backoffice that we would want to configure for our users. An example: 2FA. Maybe we only want to enable 2FA functionality for the administrators user group. Or maybe we want to reset the 2FA functionality for a specific user. Well, we are able to easily do that with these content apps. You could also use the content app to set up permissions for certain fields or other content apps. Maybe someone will even make a special permissions package that other packages could use!
So, I think there are enough use cases here. And the good thing about this change is that if you have no content apps, then there isn't a change for you! As long as there is only one content app (the default Umbraco one) then you don't see a change from the current interface.
Few things about the code:
- I am not using the EditorNavigation model now as Content App is just basically that, but with more options. Is this okay? Or should I map the content apps back to the editor navigation model?
- I added the same changes to the CommonMapper as for this PR (https://github.com/umbraco/Umbraco-CMS/pull/11553). It was feedback on the other one to keep it backward compatible
How to test:
Include this code to the project:
public class TestContentComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.ContentApps().Append<TestContentAppFactory>();
}
}
public class TestContentAppFactory : IContentAppFactory
{
public ContentApp GetContentAppFor(object source, IEnumerable<IReadOnlyUserGroup> userGroups)
{
if (source is not IUser && source is not IUserGroup)
return null;
return new ContentApp
{
Name = "2FA",
Alias = "2fa",
View = "/App_Plugins/Test/test.html",
Icon = "icon-security-camera"
};
}
}
Hi there @patrickdemooij9, thank you for this contribution! 👍
While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
- [ ] It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
- [ ] The automated tests all pass (see "Checks" tab on this PR)
- [ ] The level of security for this contribution is the same or improved
- [ ] The level of performance for this contribution is the same or improved
- [ ] Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
- [ ] If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
- [ ] The contribution looks original and the contributor is presumably allowed to share it
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.
If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.
Thanks, from your friendly Umbraco GitHub bot 🤖 🙂
Hey @patrickdemooij9 if you could find a few minutes to deal with the merge conflicts, I'll endeavour to pick this up for review.
bing bong paging @patrickdemooij9 - I can have a look at merging this if you can deal with the conflicts 😄
@nathanwoulfe thanks for the reminder. It has been a while! Managed to get the merge conflicts resolved, but having some difficulties running Umbraco v10 (probably because of switching from v9 to v10), so I haven't been able to test it working yet.
All good @patrickdemooij9, I'll take it for a spin and let you know if I have any issues.
Hi @patrickdemooij9!
I was recently going through some of the longer running PRs, and noticed this one (it's been a while, so there are now some conflicts sorry!)
I was just wondered what the status of it was and if you needed anything to progress it?
Thanks,
Emma 🙂
Hi @emmagarland I think the pull request was all done, though I see that it has gotten some conflicts in the time that it was open. I'll see how easy it is to fix the conflicts
Thanks @patrickdemooij9, let us know if you need anything! 😃
Hi again @patrickdemooij9!
So, I've since talked to the team and due to the new backoffice coming in, it will be best to hold off until the work can be achieved there. Of course, you're very welcome to look into creating the feature for v13 too if you wish.
Apologies; I know I encouraged you to work on it, but it turns out we've got some new insights, and don't want to waste any of your time!
I'll close this PR for now, hope this makes sense,
Thanks again
Emma