public static void GrantDAuthsToRoles(IList <DynamicAuth> auths, IList <string> roleIDs, IList <string> operations, string tag, string granterID, string granterName)
        {
            using (TransactionScope trans = new TransactionScope())
            {
                try
                {
                    IList <DynamicPermission> dps = GrantDAuths(auths, roleIDs, operations, DynamicPermissionCatalog.SysCatalogEnum.SYS_ROLE.ToString(), tag, granterID, granterName);
                    SysRole[] rols = SysRole.FindAll(Expression.In("RoleID", roleIDs.ToList()));

                    foreach (DynamicPermission tdp in dps)
                    {
                        IEnumerable <SysRole> roles = rols.Where(tent => tent.RoleID == tdp.Data);

                        if (roles.Count() > 0)
                        {
                            SysRole trole = roles.First();

                            tdp.Name = trole.Name;
                            tdp.Tag  = trole.Type.ToString();
                        }

                        tdp.Update();
                    }

                    trans.VoteCommit();
                }
                catch (Exception ex)
                {
                    trans.VoteRollBack();
                    throw ex;
                }
            }
        }
        /// <summary>
        /// 由ID集合获取权限集合
        /// </summary>
        /// <param name="authIDs"></param>
        /// <returns></returns>
        public static ICollection <SysRole> GetRoleByIDs(ICollection ids)
        {
            ICollection myIDs = null;

            if (ids is JArray)
            {
                JArray arr = ids as JArray;
                myIDs = new List <string>(arr.Values <string>());
            }
            else
            {
                myIDs = ids;
            }

            SysRole[] tEnts = SysRole.FindAll(Expression.In("RoleID", myIDs));

            return(tEnts);
        }