Exemplo n.º 1
0
 /// <summary>
 /// 判断用户是否可以进入后台
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static bool IsAllowEntryControlPannel(this IUser user)
 {
     if (user.IsSuperAdministrator() || user.IsContentAdministrator())
     {
         return(true);
     }
     return(user.IsInRoles(ApplicationAdministratorRoleNames.GetAll().ToArray()));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 是不是应用管理员
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="applicationId">应用Id</param>
        /// <returns>是应用管理员返回true,否则返回false</returns>
        public bool IsApplicationManager(IUser currentUser, int applicationId)
        {
            IEnumerable <string> roleNames = ApplicationAdministratorRoleNames.GetRoleNames(applicationId);

            if (roleNames != null && roleNames.Count() > 0)
            {
                if (currentUser.IsInRoles(roleNames.ToArray()))
                {
                    return(true);
                }
            }

            return(false);
        }