Base solution for your next web application

Activities of "fawad29"

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

Question

Hi,

We need to implement group level permissions. The current permissions that we have on ANZ are role based and user based. In our multi tenant application, we would like to have permissions setup as explained below.

Roles - E.g Local Administrator is tennat wide Groups - For example, each tenant can have multiple Groups GroupA, GroupB and son on. Users - Each Users belongs to a role and a group.

Permissions

Local Administrator role is allowed to view MenuA and MenuB. Group A is allowed to view MenuA but not MenuB. Group B is allowed to view MenuB but not MenuA.

UserA belongs to Local Administrator role and Group A, if User A logs in then we would like User A to see Group A menu only even though his/her role has access to both Menu items but his Group is not allowed to access MenuB. This way we don't have to assign permissions for each user, we can assign UserA to Group A and all permissions should be set up like that. Also, we do not want to create multipl role variations such as Local Administratar A, Local Administrator B.

UserB belongs to Local Administrator role and Group B, if User B logs in then we would like User B to see Group B menu only even though his/her role has access to both Menu items but his Group is not allowed to access MenuA.

What is the best way to implement above? Do we need to create new tables/views to handle permissions for Groups, if yes, is there any guidance on how to implement it?

Product Details 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 @maliming,

I have followed your suggestion. I am now receiving following error:

My update dto is as follows.

Please advice.

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,

I am following the link displayed below for implementing entity history.

https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Features-Mvc-Core-Entity-History

I have an entity class which has some properties. When I update this entity, audit logs does not show old (previous) value, it only shows the new i.e. updated values. For example, if my entity has a property called Name and I update its value from UserA to UserB, the audit log does not show UserA as old Values.

Entity is shown below

EntityFrameworkCoreModule is shown below

EntityHistoryHelper code is shown below:

Can you please help?

Thanks

We have an entity which inherits from IMustHaveTenant. We want to assign tenant id from the session using AbpSession.GetTenantId() when a tenant user creates this entity, can you please confirm the best place to assign tenant id? Should this be done in the Create function of the EntityAppService?

Hi,

The link is broken, please update it.

https://github.com/aspnetzero/aspnet-zero-core/issues/2691

Thanks

Answer

sorry, the link to the library is:

<a class="postlink" href="https://github.com/joshfire/jsonform/wiki">https://github.com/joshfire/jsonform/wiki</a>

Answer

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

Showing 61 to 70 of 79 entries