Skip to content

Commit a5cdbb0

Browse files
authored
Merge pull request #249 from topcoder-platform/issues-217
Issues-217: check member group permissions
2 parents bf1c7bc + 5d722d6 commit a5cdbb0

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

config/vanilla/bootstrap.before.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,15 @@ function watchButton($categoryID) {
362362
/**
363363
* Check group permission for the current user
364364
* @param $groupID
365-
* @param null $permission null - any permission for a group
365+
* @param null $category
366+
* @param null $permissionCategoryID
367+
* @param null $permission null - any permission for a group
366368
* @param bool $fullMatch
367369
* @return bool return true if user has a permission
368370
*/
369-
function checkGroupPermission($groupID,$permission = null, $fullMatch = true) {
371+
function checkGroupPermission($groupID, $category = null , $permissionCategoryID = null , $permission = null, $fullMatch = true) {
370372
$groupModel = new GroupModel();
371-
return $groupModel->checkPermission(Gdn::session()->UserID,$groupID, $permission, $fullMatch);
373+
return $groupModel->checkPermission(Gdn::session()->UserID,$groupID, $category,$permissionCategoryID , $permission, $fullMatch);
372374
}
373375
}
374376

vanilla/applications/dashboard/models/class.usermodel.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,13 +1094,15 @@ public function joinUsers(&$data, $columns, $options = []) {
10941094
$user = $users[$iD] ?? false;
10951095
foreach ($join as $column) {
10961096
$value = $user[$column];
1097+
// This code executes about 0,5 sec per a row
1098+
/*
10971099
if ($column == 'Photo') {
10981100
if ($value && !isUrl($value)) {
10991101
$value = Gdn_Upload::url(changeBasename($value, 'n%s'));
11001102
} elseif (!$value) {
11011103
$value = UserModel::getDefaultAvatarUrl($user);
11021104
}
1103-
}
1105+
}*/
11041106
setValue($px.$column, $row, $value);
11051107
}
11061108
} else {

vanilla/applications/vanilla/models/class.categorymodel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ public static function checkPermission($category, $permission, $fullMatch = true
905905
}
906906

907907
if($groupID && $groupID > 0) {
908-
$result = checkGroupPermission($groupID);
908+
$result = checkGroupPermission($groupID, $category, $permissionCategoryID, $permission, $fullMatch);
909909
} else {
910910
$result = Gdn::session()->checkPermission($permission, $fullMatch, 'Category', $permissionCategoryID)
911911
|| Gdn::session()->checkPermission($permission, $fullMatch, 'Category', $categoryID);

0 commit comments

Comments
 (0)