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

Activities of "omar"

Thank you for your help. The content for the notification will be generated by each entity. Each of the following entity will generate a notification.

Thank you for your help. In case anyone need it.

class User

[Required(AllowEmptyStrings=true)]
        public override string EmailAddress { get; set; }

UserManager

public override async Task<IdentityResult> CheckDuplicateUsernameOrEmailAddressAsync(long? expectedUserId, string userName, string emailAddress)
        {
            var user = (await FindByNameAsync(userName));
            if (user != null && user.Id != expectedUserId)
            {
                return AbpIdentityResult.Failed(string.Format("Name {0} is already taken.", userName));
            }

            // if email  address was provided, check that it does not exist
            if (!string.IsNullOrEmpty(emailAddress))
            {
                user = (await FindByEmailAsync(emailAddress));
                if (user != null && user.Id != expectedUserId)
                {
                    return AbpIdentityResult.Failed(string.Format("Email Address {0} is already taken.", emailAddress));
                }
            }

            return IdentityResult.Success;
        }

You mentioned that "this may break login". I was going over the AbpUserManager.cs class, but I was not able to find a problem since the LoginAsyncInternal function use the username or email to login. Any idea where this will break? Thanks again

Thank You!

You should be able to change the name of your table during OnModelCreating. You can overwrite DataAnnotation of the table name . Code-First gives precedence to Fluent API > data annotations > default conventions.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
  
            modelBuilder.Entity<AuditLog>().ToTable("AuditLogs ");
                    
        }

Abp user permission to authorize the users. If you are using the attribute [AbpAuthorize("name of permission")] in your controller or action, Abp will authorize the user based on that. You can think of a role as a way to group a number of permissions together. For instance, an Admin role can do CRUD on all users. This can be done with [Authorize(Role="admin)"] from asp.net mvc. The problem is when you need to prevent a particular admin user from doing it all. Let's say you want John to Create, Update but not Delete.

Basically, they serve the "same purpose", but permission give you more granular control. Hope that helps

I am having the same issue when using AbpApiController.

public class UsersController : AbpApiController
    {
        private readonly IRepository<User, long> _userRepo;
      
        public UsersController(  IRepository<User,long> userRepo)
        {     
            _userRepo = userRepo;
        }

        [HttpGet]
        [UnitOfWork]
        public virtual dynamic GetAll()
        {
           return _userRepo.GetAllList();
        } 
    }

That worked for me. Thanks

Showing 1 to 7 of 7 entries