/// <summary>
        ///
        /// </summary>
        /// <param name="permissionDesp"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool UserHasPermissions(this PermissionDescriptionAttribute permissionDesp, IUser user)
        {
            bool result = false;

            if (permissionDesp != null && user != null)
            {
                ApplicationAndPermissionObjectsCollection pods = PermissionDescriptionParser.ParseApplicationAndPermissionObjects(permissionDesp.Description);

                foreach (ApplicationAndPermissionObjects pod in pods)
                {
                    foreach (string permissionCodeName in pod.PermissionObjectCodeNames)
                    {
                        if (user.Permissions[pod.ApplicationCodeName, permissionCodeName] != null)
                        {
                            result = true;
                            break;
                        }
                    }

                    if (result)
                    {
                        break;
                    }
                }
            }

            return(result);
        }
        /// <summary>
        /// 根据权限对象的描述(应用的名称1:角色名称11,角色名称12,...;应用名称2:角色名称21,角色名称22,...)
        /// </summary>
        /// <param name="description"></param>
        /// <returns></returns>
        public static ApplicationAndPermissionObjectsCollection ParseApplicationAndPermissionObjects(string description)
        {
            ApplicationAndPermissionObjectsCollection pods = new ApplicationAndPermissionObjectsCollection();

            if (description.IsNotEmpty())
            {
                string[] appRoles = description.Split(';');

                for (int i = 0; i < appRoles.Length; i++)
                {
                    string[] oneAppRoles = appRoles[i].Split(':');

                    if (oneAppRoles.Length == 2)
                    {
                        string appName = oneAppRoles[0].Trim();

                        ApplicationAndPermissionObjects pod = pods[appName];

                        if (pod == null)
                        {
                            pod = new ApplicationAndPermissionObjects(appName);
                            pods.Add(pod);
                        }

                        string[] pos = oneAppRoles[1].Split(',');

                        for (int j = 0; j < pos.Length; j++)
                        {
                            string roleName = pos[j].Trim();

                            pod.PermissionObjectCodeNames.Add(roleName);
                        }
                    }
                }
            }

            return(pods);
        }