Esempio n. 1
0
        /// <summary>
        /// Check whether a user is granted for a permission.
        /// 检查用户是否授权
        /// </summary>
        /// <param name="manager">User manager / 用户管理</param>
        /// <param name="userId">User id / 用户ID</param>
        /// <param name="permissionName">Permission name / 权限名称</param>
        public static bool IsGranted <TRole, TUser>(AbpUserManager <TRole, TUser> manager, long userId, string permissionName)
            where TRole : AbpRole <TUser>, new()
            where TUser : AbpUser <TUser>
        {
            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }

            return(AsyncHelper.RunSync(() => manager.IsGrantedAsync(userId, permissionName)));
        }
Esempio n. 2
0
        public static AbpUserManager <TTenant, TRole, TUser> .AbpLoginResult Login <TTenant, TRole, TUser>(AbpUserManager <TTenant, TRole, TUser> manager, string userNameOrEmailAddress, string plainPassword, string tenancyName = null)
            where TTenant : AbpTenant <TUser>
            where TRole : AbpRole <TUser>, new()
            where TUser : AbpUser <TUser>
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            return(AsyncHelper.RunSync(() => manager.LoginAsync(userNameOrEmailAddress, plainPassword, tenancyName)));
        }