Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "andry3ag"

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.

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

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

I cannot find any documentation regarding this issue. Has anyone done this before? If so, some help would be great. Do I have to deploy twice or is it better to convert the module to a NuGet package, so I only have to deploy once?

I have successfully deployed a solution to azure but when I try to create an account on the login page the bottom of the modal displays the following message:" ERROR for site owner:Invalid domain for site key " and I cannot create a new user so I can login. I have attached the snapshot of the modal incase if its helps.


public class Dashboard : FullAuditedEntity<int, DashboardModuleUser> { ...

    public virtual ICollection&lt;Widget&gt; Widgets { get; set; }
}

public class Widget : FullAuditedEntity&lt;int, DashboardModuleUser&gt;
{
    [ForeignKey("WidgetTemplateId")]
    public virtual WidgetTemplate WidgetTemplate { get; set; }
    public virtual int WidgetTemplateId { get; set; }

    [ForeignKey("DashboardId")]
    public virtual Dashboard Dashboard { get; set; }
    public virtual int DashboardId { get; set; }
}

So, I have the relationship above established, but when I return it to the frontend as PagedResult, it seems the Widgets in the Dashboard are not eager loading.

How should I setup to ensure my collection of Dashboards will eagerload Widgets and all my Widgets will inturn eager load WidgetTemplate BUT not Dashboard of course, else it will have circular reference issue.

My current Dto for Dashboard are set up as so:

[AutoMapFrom(typeof(Dashboard))]
public class DashboardDto : EntityDto
{
    public string Title { get; set; }

    public DashboardModuleUser User { get; set; }

    public string Content { get; set; }

    public IEnumerable&lt;Widget&gt; Widgets { get; set; }
}

Thank you.

Question

Hi,

how do I establish many-to-many relationship? For example, if a blog has many entries and and entry can belong to many blogs?

I tried setting doing it code first as suggested in this url <a class="postlink" href="http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx">http://www.entityframeworktutorial.net/ ... first.aspx</a> but when I do Add-Migration, the script do not seems to create the joining table.

Hi I have a few questions that would like to be answered.

1 I am trying to create multiple modules and have a core application that is compose of these multiple modules. However, it seems that a module will only expose it's controllers to the core application. When a web controller tries to deliver a view template, it tries to find the template file in the core application filesystem rather than the module's. I figured we can have a build process that copies all the frontend files to the core application, but I would like to know if there's any better approach you would recommend.

If this is the only approach, do you have a build script we can have access to?

2 Do individual module need to include module zero and all the multi tenancy, permissions, authentication logic? Can all this be simply handled from the core application so that there is only a single source of truth?

If not, how do we handle it? The examples available online do not seem to address this issue.

3 How do we handle relationships that stranded over 2 or more plugins or between plugins and the core application? For example, user having 1 to many blog entity where blog is part of the Blog plugin.

  • From which end do we address the relationship? From the core application or from the module end? Or both?
Showing 21 to 30 of 31 entries