Do you mean I should get menu from database in SetNavigation
function of AppNavigationProvider1
as shown below?
public override void SetNavigation(INavigationProviderContext context)
{
var menu = context.Manager.Menus[MenuName] = new MenuDefinition(MenuName, new FixedLocalizableString("Main Menu"));
var myList = _myMenuService.GetMenusByMyParameter(_mySession.myParameter);
foreach(MyMenuItem myMenuItem in myList)
{
menu.AddItem(new MenuItemDefinition(
myMenuItem.Text,
L(myMenuItem.Text),
url: myMenuItem.url,
icon: myMenuItem.icons,
permissionDependency: new SimplePermissionDependency(myMenuItem.permissionString)
)
}
}
Hi @ismcagdas,
I have found UserManager class, but it does not have IsGranted method? Where shall I find IsGranted method because as per @ryancyq suggestion I would need to changed it so that i set it to true if User's current primary group has permission for a menu and false if he/she has not? I am assuming simply setting IsGranted to false will hide the menu.
Thank you @ryancyq, I am learning ANZ so please bear with me.
I have created both tables, where should I create PermissionGroupRoleRemover event handler? I have created GroupID instead of UserId in PermissionGroup table.
I can't find AbpUserManager in my solution, do I need to extend any class?
Thanks
Hi,
Thanks for your reply, I think I need to implement it my self at group level because it will be prohibitive to do so at user level due to number of users and same user can be part of more than one groups.
Can you provide any guidance on how to go about it?
Thanks
Hi @maliming,
Please see below the required information.
[Table("Ethnicities")]
//[Audited]
public class Ethnicity : FullAuditedEntity, IMustHaveTenant
{
public Ethnicity()
{
Clients = new HashSet<Client>();
}
[MinLength(EthnicityConsts.MinCodeLength)]
[MaxLength(EthnicityConsts.MaxCodeLength)]
[Required]
// [Audited]
public string Code { get; set; }
[MinLength(EthnicityConsts.MinTextLength)]
[MaxLength(EthnicityConsts.MaxTextLength)]
[Required]
// [Audited]
public string Text { get; set; }
//[Audited]
public virtual int TenantId { get; set; }
[Required]
public int DisplayOrder { get; set; }
public virtual ICollection<Client> Clients { get; set; }
}
App service is displayed below.
//[DisableAuditing]
[AbpAuthorize(AppPermissions.Pages_Administration_Ethnicities)]
// [Audited]
public class EthnicityAppService : MyAppServiceBase, IEthnicityAppService
{
private readonly IRepository<Ethnicity> _ethnicityPLRepositroy;
public EthnicityAppService(IRepository<Ethnicity> ethnicityPLRepositroy)
{
_ethnicityPLRepositroy = ethnicityPLRepositroy;
}
[AbpAuthorize(AppPermissions.Pages_Administration_Ethnicities)]
public async Task<ListResultDto<EthnicitiesListDto>> GetEthnicity(GetEthnicityInput getEthnicityInput)
{
var ethnicity = _ethnicityPLRepositroy.GetAll()
.WhereIf(
!getEthnicityInput.Filter.IsNullOrWhiteSpace(),
filter =>
(filter.Code.Contains(getEthnicityInput.Filter) || filter.Code.StartsWith(getEthnicityInput.Filter)) ||
(filter.Text.Contains(getEthnicityInput.Filter) || filter.Text.StartsWith(getEthnicityInput.Filter))
);
var ethnicityCount = await ethnicity.CountAsync();
ethnicity = ethnicity.OrderBy(getEthnicityInput.Sorting).PageBy(getEthnicityInput);
return new PagedResultDto<EthnicitiesListDto>(
ethnicityCount,
ObjectMapper.Map<List<EthnicitiesListDto>>(ethnicity)
);
}
[AbpAuthorize(AppPermissions.Pages_Administration_Ethnicities_Create)]
public async Task Create(CreateEthnicityInputDto createEthnicityPLInputDto)
{
var ethnicityEntity = ObjectMapper.Map<Ethnicity>(createEthnicityPLInputDto);
ethnicityEntity.TenantId = (Int32)AbpSession.TenantId;
var displayOrder = _ethnicityPLRepositroy
.GetAll().Where(x => x.IsDeleted == false & x.TenantId == ethnicityEntity.TenantId)
.Select(x => x.DisplayOrder)
.Max();
ethnicityEntity.DisplayOrder = displayOrder + 1;
var result = await _ethnicityPLRepositroy.InsertAsync(ethnicityEntity);
}
public async Task<GetEthnicityEditOutput> GetById(int id)
{
var ethnicityPLEntity = await _ethnicityPLRepositroy.GetAsync(id);
var ethnicityPLEditDto = ObjectMapper.Map<EthnicityEditDto>(ethnicityPLEntity);
var getEthnicityPLEditOutput = new GetEthnicityEditOutput();
getEthnicityPLEditOutput.EthnicityEditDto = ethnicityPLEditDto;
return getEthnicityPLEditOutput;
}
[AbpAuthorize(AppPermissions.Pages_Administration_Ethnicities_Edit)]
public async Task Update(UpdateEthnicityInputDto updateEthnicityPLInputDto)
{
var ethnicityPLEntity = ObjectMapper.Map<Ethnicity>(updateEthnicityPLInputDto);
ethnicityPLEntity.TenantId = (Int32)AbpSession.TenantId;
var result = await _ethnicityPLRepositroy.UpdateAsync(ethnicityPLEntity);
}
[AbpAuthorize(AppPermissions.Pages_Administration_Ethnicities_Delete)]
public async Task Delete(UpdateEthnicityInputDto updateEthnicityPLInputDto)
{
await _ethnicityPLRepositroy.DeleteAsync(updateEthnicityPLInputDto.Id);
}
}
Hi @demirmusa,
Product version is 8.0.0. ABP Framework is the one which came with version 8.0.0. ASP.NET Core MVC & jQuery Project
Hi,
The link is broken, please update it.
https://github.com/aspnetzero/aspnet-zero-core/issues/2691
Thanks
sorry, the link to the library is:
<a class="postlink" href="https://github.com/joshfire/jsonform/wiki">https://github.com/joshfire/jsonform/wiki</a>
Hi,
It is more to find out if dynamically generated approach will work with ABP framework. I have found following library which takes input in a json format and then creates form dynamically that conforms to angularjs binding etc. So if a form is created dynamically, will it still work with ABP framework. Do I need to consider any issues?
The second question is that ABP follows code first approach i.e. it creates database from modal, does ABP also work other way around i.e. creating Model at runtime from SQL table.
Thanks