Ok that solved it for my users (I could hide the two-factor part at least) in the MVC part of my app.
I then figured out I had to do the same for Blazor and overrode ISettingComponentContributor
and added this code to hide it
//Hide the account menu item (Self registration/Two-factor/captcha/google-fb-etc
var accountMenuToRemove = context.Groups.Find(x => x.Id == "Volo.Abp.Account");
context.Groups.Remove(accountMenuToRemove);
Two questions then (and them I´m done I promise)
And I managed to get this up and running on my commercial code so I will be closing this. Small caveat was that I did try to have it on my IdentityService instance but that caused me some "resource not found" exceptions so I just moved it to the Public page.
Thank you so much. I really appreciate it!
Have you really tried doing this with my code (Github+insert records)?
Shouldn´t it show some documents on the document page if there are records in the database?
I don´t know what to do here... file new project + module installing + connecting to Github and getting data == not working
I know how to guard against null exceptions 😉 its just that Groups never contains Volo-Abp-Account-TwoFactor, that is that error..
BUT the thing is that I want to remove the whole Account tab and not just from within it!
If I filter it out by "AbpAccount.SettingManagement" and try to remove it with the PermissionDataSeeder the whole Settings menu gets removed.
I have (as stated above) tried using PermissionDataSeedContributor to remove access to the menu item like this (my code is longer and little different of course)
.Select(p => p.Name)
.WhereIf(x=>tenantId.HasValue && providerKey == RoleConstants.Tenantuser,
x => !x.Contains("AbpAccount.SettingManagement")
.ToArray();
and then using PermissionGrantRepository.InsertAsync() to give the user permissions (but not that one) BUT then the WHOLE Settings menu goes away
This error seems not related to ABP. Are you sure? How I read it is that "Volo-Abp-Account-TwoFactor" just isn´t in the Groups?
And I wan´t to hide the whole Account menu item and not individual parts of it. And just for Tenants and users but not Host.
Here is the code
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Volo.Abp.Account.Public.Web.ProfileManagement;
using Volo.Abp.Identity;
using Volo.Abp.Users;
namespace BSR.Beinni.ProfileManagement;
public class AccountProfileManagementPageContributor : IProfileManagementPageContributor
{
public async Task ConfigureAsync(ProfileManagementPageCreationContext context)
{
context.Groups.ForEach(Console.WriteLine);
// Here I was just trying to take out TwoFactor BUT I wan´t to remove the whole Account
context.Groups.Remove(context.Groups.First(x => x.Id == "Volo-Abp-Account-TwoFactor"));
await Task.CompletedTask;
}
protected virtual async Task<bool> IsPasswordChangeEnabled(ProfileManagementPageCreationContext context)
{
var userManager = context.ServiceProvider.GetRequiredService<IdentityUserManager>();
var currentUser = context.ServiceProvider.GetRequiredService<ICurrentUser>();
var user = await userManager.GetByIdAsync(currentUser.GetId());
return !user.IsExternal;
}
}
and then inI have
Configure<ProfileManagementPageOptions>(options =>
{
options.Contributors.Add(new ProfileManagement.AccountProfileManagementPageContributor());
});
Did you configure the DocsUiOptions as below?
Yes I did. Its here https://github.com/sturlath/Acme.MyProject/blob/36113e1832f5b0503f7453304d143dd9641e37b6/src/Acme.MyProject.Web/MyProjectWebModule.cs#L122
I have tried what ever permutation of the URL I can think of but its just 404 and now I see some error (didn´t spot them before because the 404 page automatically goes-browser-history-back
I´m trying to remove (just) the Account part from my Settings in Blazor for newly created tenant/users
If I filter it out by "AbpAccount.SettingManagement" and try to remove it with the PermissionDataSeeder the whole Settings menu gets removed. For ordinary user removing Settings could be fine but I have more stuff than just Account for my tenants.
I tried these two https://support.abp.io/QA/Questions/1690/HOW-TO-remove--Two-factor-item and https://support.abp.io/QA/Questions/2926/Remove-two-auth-and-Profile-picture-tab-from-manage-profile-page but I just get this error if I try to remove an individual component "Volo-Abp-Account-TwoFactor"
you need to add the Volo.Docs.Admin.Web project to your web project
OK.. but why doesn´t the CLI do that (or say abp add-module Volo.Docs.Admin
)? I can´t find anything in the docs about specially having to do this (sorry for missing it if it is in there)
Anyways I updated the project and still the same 404 result
Again I get the data from Github into my database but they don´t display!
Again here is the data I got in the docs tables. Don´t you get 404?
What am I missing?
Project
INSERT INTO [dbo].[DocsProjects]([Id],[Name],[ShortName],[Format],[DefaultDocumentName],[NavigationDocumentName],[ParametersDocumentName],[MinimumVersion],[DocumentStoreType],[MainWebsiteUrl],[LatestVersionBranchName],[ExtraProperties],[ConcurrencyStamp])
SELECT N'73ccfbdd-e7f7-42e4-9a1f-3a049fa859c7', N'ÍBeinni Documentation', N'docs', N'md', N'Index', N'docs-nav.json', N'docs-params.json', NULL, N'GitHub', N'/', N'master', N'{"GitHubRootUrl":"https://github.com/Ibeinni/docs/tree/{version}/","GitHubUserAgent":"sturlath","GitHubAccessToken":"xxx","GithubVersionProviderSource":1,"VersionBranchPrefix":"rel-"}', N'40d06f2b75e6430181a7bc1bdabdf54f'
Docs
INSERT INTO [dbo].[DocsDocuments]([Id],[ProjectId],[Name],[Version],[LanguageCode],[FileName],[Content],[Format],[EditLink],[RootUrl],[RawRootUrl],[LocalDirectory],[CreationTime],[LastUpdatedTime],[LastSignificantUpdateTime],[LastCachedTime],[ExtraProperties],[ConcurrencyStamp])
SELECT N'f0c3727d-6b83-f2a6-d22f-3a04f63982f1', N'73ccfbdd-e7f7-42e4-9a1f-3a049fa859c7', N'SampleMenuItem_1_1_1.md', N'1.0', N'en', N'SampleMenuItem_1_1_1.md', N'
# Hello World', N'md', N'https://github.com/Ibeinni/docs/blob/1.0/en/SampleMenuItem_1_1_1.md', N'https://github.com/Ibeinni/docs/tree/1.0/', N'https://raw.githubusercontent.com/Ibeinni/docs/1.0/en/', N'', '20220709 17:35:45.000', '20220709 17:35:45.000', NULL, '00010101 00:00:00.000', N'{}', N'e5e9e564c9104f53a0d383ebe2534925' UNION ALL
SELECT N'6b9c2b8c-ace5-9768-0119-3a04f648a310', N'73ccfbdd-e7f7-42e4-9a1f-3a049fa859c7', N'SampleMenuItem_1_1_1.md', N'1.1', N'en', N'SampleMenuItem_1_1_1.md', N'
# Hello World', N'md', N'https://github.com/Ibeinni/docs/blob/1.1/en/SampleMenuItem_1_1_1.md', N'https://github.com/Ibeinni/docs/tree/1.1/', N'https://raw.githubusercontent.com/Ibeinni/docs/1.1/en/', N'', '20220709 17:35:45.000', '20220709 17:35:45.000', NULL, '00010101 00:00:00.000', N'{}', N'8919f724e4f54f9ba6d0501681da5945' UNION ALL
SELECT N'059d90b9-d323-1d36-3425-3a0508b43496', N'73ccfbdd-e7f7-42e4-9a1f-3a049fa859c7', N'SampleMenuItem_1_1_1.md', N'1.0', N'is', N'SampleMenuItem_1_1_1.md', N'
# Hello World', N'md', N'https://github.com/Ibeinni/docs/blob/1.0/is/SampleMenuItem_1_1_1.md', N'https://github.com/Ibeinni/docs/tree/1.0/', N'https://raw.githubusercontent.com/Ibeinni/docs/1.0/is/', N'', '20220709 17:35:45.000', '20220709 17:35:45.000', NULL, '20220713 07:47:55.158', N'{}', N'45fb4081e9c244778701fa6b0b7d2e6e'
p.s Adding these lines below results in a 500.3 error ("HTTP Error 500.30 - ASP.NET Core app failed to start")
Configure<DocsElasticSearchOptions>(options =>
{
options.Enable = true;
});