FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Performance optimizations by juvander · Pull Request #29 · DNNCommunity/DNN.Repository · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cs  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 5 additions & 3 deletions Repository.ascx.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1763,15 +1763,16 @@ private void BindObjectList()

bool bIsPersonal = false;
bIsPersonal = false;
bool isAdministrator = PortalSecurity.IsInRole("Administrators");

if (Settings["IsPersonal"] != null) {
if (Settings["IsPersonal"] != null) {
bIsPersonal = bool.Parse(Settings["IsPersonal"].ToString());
}


if (bIsPersonal) {
foreach (RepositoryInfo dataitem in repositoryItems) {
if (int.Parse(dataitem.CreatedByUser) == UserId | PortalSecurity.IsInRole("Administrators")) {
if (int.Parse(dataitem.CreatedByUser) == UserId | isAdministrator) {
bindableList.Add(dataitem);
}
}
Expand All @@ -1789,7 +1790,7 @@ private void BindObjectList()
if (dataitem.SecurityRoles.StartsWith("U:")) {
string _targetUser = dataitem.SecurityRoles.Substring(2);
// admins see all items
if (string.IsNullOrEmpty(_targetUser) | PortalSecurity.IsInRole("Administrators")) {
if (string.IsNullOrEmpty(_targetUser) | isAdministrator) {
bindableList.Add(dataitem);
} else {
if (HttpContext.Current.User.Identity.IsAuthenticated) {
Expand Down Expand Up @@ -1933,6 +1934,7 @@ private bool CheckAnyUserRoles(string roles)
if (!string.IsNullOrEmpty(Item)) {
if (PortalSecurity.IsInRole(Item)) {
found = true;
continue;
}
}
}
Expand Down
44 changes: 26 additions & 18 deletions RepositoryDashboard.ascx.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ private bool CheckAnyUserRoles(string roles)
if (!string.IsNullOrEmpty(Item)) {
if (PortalSecurity.IsInRole(Item)) {
found = true;
continue;
}
}
}
Expand Down Expand Up @@ -654,20 +655,25 @@ private ArrayList RecalcCategoryCount(ArrayList categories)
ArrayList repositoryItems = repository.GetRepositoryObjects(m_RepositoryId, "", "Downloads", 1, -1, "", -1);
ArrayList bindableList = new ArrayList();
LoadBindableList(bIsPersonal, repositoryItems, bindableList);

// recalc the category counts
foreach (RepositoryCategoryInfo category in categories) {
foreach (RepositoryInfo item in bindableList) {
ArrayList cats = rc.GetRepositoryObjectCategories(item.ItemId);
foreach (RepositoryObjectCategoriesInfo _cat in cats) {
if (_cat.CategoryID == category.ItemId) {
category.Count = category.Count + 1;
}
}
}
}

return categories;

// recalc the category counts
foreach (RepositoryInfo item in bindableList)
{
ArrayList cats = rc.GetRepositoryObjectCategories(item.ItemId);
foreach (RepositoryObjectCategoriesInfo _cat in cats)
{
foreach (RepositoryCategoryInfo category in categories)
{
if (_cat.CategoryID == category.ItemId)
{
category.Count = category.Count + 1;
}
}
}
}


return categories;

}

Expand Down Expand Up @@ -761,10 +767,12 @@ private void BindData()
}

private void LoadBindableList(bool bIsPersonal, ArrayList repositoryItems, ArrayList bindableList)
{
if (bIsPersonal) {
foreach (RepositoryInfo dataitem in repositoryItems) {
if (int.Parse(dataitem.CreatedByUser) == UserId | PortalSecurity.IsInRole("Administrators")) {
{
if (bIsPersonal)
{
bool isAdministrator = PortalSecurity.IsInRole("Administrators");
foreach (RepositoryInfo dataitem in repositoryItems) {
if (int.Parse(dataitem.CreatedByUser) == UserId | isAdministrator) {
bindableList.Add(dataitem);
}
}
Expand Down

Back | FazBrowse Home | New Git URL