Пример #1
0
 public async Task <int> CountOfRoles(int siteId, string searchInput)
 {
     if (multiTenantOptions.UseRelatedSitesMode)
     {
         siteId = multiTenantOptions.RelatedSiteId;
     }
     return(await dbRoles.GetCountOfSiteRoles(siteId, searchInput));
 }
Пример #2
0
        //public IList<ISiteRole> GetRolesUserIsNotIn(
        //    int siteId,
        //    int userId)
        //{
        //    IList<ISiteRole> roles = new List<ISiteRole>();
        //    using (DbDataReader reader = dbRoles.GetRolesUserIsNotIn(siteId, userId))
        //    {
        //        SiteRole role = new SiteRole();
        //        role.LoadFromReader(reader);

        //        roles.Add(role);
        //    }
        //    return roles;
        //}

        //public async Task<List<int>> GetRoleIds(int siteId, string roleNamesSeparatedBySemiColons)
        //{
        //    List<int> roleIds = new List<int>();
        //    List<string> roleNames = GetRolesNames(roleNamesSeparatedBySemiColons);

        //    foreach (string roleName in roleNames)
        //    {
        //        if (string.IsNullOrEmpty(roleName)) { continue; }
        //        ISiteRole r = await FetchRole(siteId, roleName);
        //        if (r == null)
        //        {
        //            log.LogDebug("could not get roleid for role named " + roleName);
        //            continue;
        //        }
        //        if (r.RoleId > -1) { roleIds.Add(r.RoleId); }
        //    }

        //    return roleIds;
        //}

        //public static List<string> GetRolesNames(string roleNamesSeparatedBySemiColons)
        //{
        //    List<string> roleNames = new List<string>();
        //    string[] roles = roleNamesSeparatedBySemiColons.Split(';');
        //    foreach (string r in roles)
        //    {
        //        if (!roleNames.Contains(r)) { roleNames.Add(r); }
        //    }

        //    return roleNames;

        //}


        public async Task <int> CountOfRoles(int siteId, string searchInput, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            return(await dbRoles.GetCountOfSiteRoles(siteId, searchInput));
        }
Пример #3
0
        //public IList<ISiteRole> GetRolesUserIsNotIn(
        //    int siteId,
        //    int userId)
        //{
        //    IList<ISiteRole> roles = new List<ISiteRole>();
        //    using (DbDataReader reader = dbRoles.GetRolesUserIsNotIn(siteId, userId))
        //    {
        //        SiteRole role = new SiteRole();
        //        role.LoadFromReader(reader);

        //        roles.Add(role);
        //    }
        //    return roles;
        //}

        //public async Task<List<int>> GetRoleIds(int siteId, string roleNamesSeparatedBySemiColons)
        //{
        //    List<int> roleIds = new List<int>();
        //    List<string> roleNames = GetRolesNames(roleNamesSeparatedBySemiColons);

        //    foreach (string roleName in roleNames)
        //    {
        //        if (string.IsNullOrEmpty(roleName)) { continue; }
        //        ISiteRole r = await FetchRole(siteId, roleName);
        //        if (r == null)
        //        {
        //            log.LogDebug("could not get roleid for role named " + roleName);
        //            continue;
        //        }
        //        if (r.RoleId > -1) { roleIds.Add(r.RoleId); }
        //    }

        //    return roleIds;
        //}

        //public static List<string> GetRolesNames(string roleNamesSeparatedBySemiColons)
        //{
        //    List<string> roleNames = new List<string>();
        //    string[] roles = roleNamesSeparatedBySemiColons.Split(';');
        //    foreach (string r in roles)
        //    {
        //        if (!roleNames.Contains(r)) { roleNames.Add(r); }
        //    }

        //    return roleNames;

        //}


        public async Task <int> CountOfRoles(int siteId, string searchInput)
        {
            return(await dbRoles.GetCountOfSiteRoles(siteId, searchInput));
        }