Base solution for your next web application

Activities of "andry3ag"

Thank you for your response.

My question is for Edition. if Edition-1 only has feature Role, OU, but its admin user has permission can see Dashboard, Role, OU ... all of them How I can control edition feature. Likes Edition-1 only has Role, OU, and Edition-1 cannot see Dashboard. Then when I create tenant-1 assigned by Editio-1, all user belong tenant-1 has permission Role, OU, cannot choice Dashboard. What is mean your Edition?

Thanks,

When I make new edition with limited feature, and attach it to new tenant, after created tenant with default admin user, and login by this admin user to new tenant, the admin user has full feature of the default tenant. e.g. default tenant has feature 1,2,3,4,5 new edition has feature 4,5, assign it to new tenant-1, then tenant-1 admin user has feature 1,2,3,4,5 and tenant-1 admin can create an new user under tenant-1, and assign any feature to this user, not limited by new edition feature.

I have figured out it. The class has been create under Core project.

How to add extend field to UserOrganizationUnits entity. <a class="postlink" href="https://www.aspnetzero.com/Documents/Extending-Existing-Entities#extending-non-abstract-entities">https://www.aspnetzero.com/Documents/Ex ... t-entities</a>

my code like :

public class MyUserOrganizationUnits : UserOrganizationUnits { public bool IsAdminOfOU {get; set;} } it does not work.

I think it is related to max parallel http connections in a browser. It is across different tabs too. So while testing/developing, make sure you don't hit the limt.

[http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser])

derek

Hi all,

I need to restyle the app into different theme by create a fresh index.html page. In the process, I need to migrate signalr related functionality. I could not get it working. (it worked intermittently actually, probably 1 out of 10 page refreshes)

here is what I did.

... jquery and others above it.
        <script src="../../Scripts/jquery.signalR-2.2.1.min.js" type="text/javascript"></script>
        <script src="/signalr/hubs"></script>
        <script src="../../Abp/Framework/scripts/libs/abp.signalr.js" type="text/javascript"></script>

I set the break point in the following function and the code 'abp.event.trigger('abp.notifications.received', notification);' which didn't get called:

commonHub.client.getNotification = function (notification) {
        abp.event.trigger('abp.notifications.received', notification);
    };

The following line was called, when I set the break point.

subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue));

In the chrome, WS tab the message is received and if I use the ASP.NET Zero page, it worked every time. Therefore it ruled out the server issue. However when it was in my own page it didn't work properly as I stated above the code 'abp.event.trigger('abp.notifications.received', notification);' which didn't get called.

Any hint will be appreciated!

derek

private void CheckChatFeaturesInternal(int? sourceTenantId, int? targetTenantId, ChatSide side) { var localizationPosfix = side == ChatSide.Sender ? "ForSender" : "ForReceiver"; if (sourceTenantId.HasValue) { if (!_featureChecker.IsEnabled(sourceTenantId.Value, AppFeatures.ChatFeature)) { throw new UserFriendlyException(L("ChatFeatureIsNotEnabled" + localizationPosfix)); }

            if (targetTenantId.HasValue)
            {
                if (!_featureChecker.IsEnabled(sourceTenantId.Value, AppFeatures.TenantToTenantChatFeature))
                {
                    throw new UserFriendlyException(L("TenantToTenantChatFeatureIsNotEnabled" + localizationPosfix));
                }
            }

...

I am wondering if the sourceTenantId and targetTenantId are the same, shouldn't the chat be enabled, instead of throw exception in the above code.

Regards,

derek

I am wondering what is the best way to add navigational property that reference a entity in a module in Core\Authorization\Users\User.cs.

The problem I am encountering is that the module normally reference the core project, and therefore the core project can not reference to the module project. Because it will create circular reference. So what is the best way to deal with it?

derek

I got it.

  1. you have to initialize the PermissionFinder properly as the following: PermissionFinder.GetAllPermissions(new AppAuthorizationProvider(false), new CalendarAuthorizationProvider()) since it won't pick up from the module PreInitialize method.
  2. login as tenant admin instead of hostadmin LoginAsDefaultTenantAdmin()

Regards,

derek

Hi!

I try to run create unit test for a custom service that inherited from IApplicationService class with permission restrictions.

Here is the steps that I took:

public static class CalendarPermission {
        public const string ListEntry = "Administration.CalendarManagement.ListEntry";
    }

    public class CalendarAuthorizationProvider : AuthorizationProvider
    {
        public override void SetPermissions(IPermissionDefinitionContext context)
        {
            var administration = context.CreatePermission("Administration");

            var calendarManagement = administration.CreateChildPermission("Administration.CalendarManagement");
            calendarManagement.CreateChildPermission(CalendarPermission.CreateEntry, null, true, null, MultiTenancySides.Tenant);
        }
    }
   public class CalenderModule : AbpModule
    {
        public override void PreInitialize() {
            Configuration.Authorization.Providers.Add<CalendarAuthorizationProvider>();
        }
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }


 public interface ICalendarService : IApplicationService
 {
        [HttpGet]
        Task<ListResultOutput<CalendarItemDto>> GetListForCurrentUser(DateTime minDate, DateTime maxDate);
 }
 
   public class CalendarService : ICalendarService {
        private readonly IRepository<CalenderItem> calenderRepository;

        [AbpAuthorize(CalendarPermission.ListEntry)]
        public async Task<ListResultOutput<CalendarItemDto>> GetListForCurrentUser(DateTime minDate, DateTime maxDate) { ...}
}

in the unit test, I do the following:

public class CalendarItem_Tests : AppTestBase {
     private ICalendarService calendarService;

     protected override void AddModules(ITypeList<AbpModule> modules) {
            base.AddModules(modules);
            modules.Add<CalenderModule.CalenderModule>();
        }
       public CalendarItem_Tests() {
            calendarService = Resolve<ICalendarService>();
        }
        [Fact]
        public async void Test_GetCalendarItems()
        {
            LoginAsHostAdmin();
           await calendarService.GetListForCurrentUser(DateTime.MinValue, DateTime.MaxValue);
        }
}

Below are the error messages:

Abp.Authorization.AbpAuthorizationException Required permissions are not granted. At least one of these permissions must be granted: Administration.CalendarManagement.ListEntry at Abp.Authorization.PermissionCheckerExtensions.<AuthorizeAsync>d__12.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\PermissionCheckerExtensions.cs:line 258 --- End of stack trace from previous location where exception was thrown ---

It seems that the PermissionFinder.GetAllPermissions in the TenantRoleAndUserBuilder class is not getting the permission Administration.CalendarManagement.ListEntry.

Much appreciated for any help!

derek

Showing 41 to 50 of 58 entries