Skip to content

Commit

Permalink
Merge pull request #38 from tractorcow/pulls/fix-env-perms
Browse files Browse the repository at this point in the history
BUG Fix issue creating environments
  • Loading branch information
Stig Lindqvist committed Oct 1, 2014
2 parents c44977b + 6816e58 commit 70e635a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions code/model/DNEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -746,19 +746,21 @@ protected function buildPermissionField($groupField, $memberField, $groups, $mem
public function getCMSFields() {
$fields = new FieldList(new TabSet('Root'));

$groups = $this
->Project()
->Viewers()
->sort('Title')
->map()
->toArray();
$members = array();
foreach($this->Project()->Viewers() as $group) {
foreach($group->Members()->map() as $k => $v) {
$members[$k] = $v;
$project = $this->Project();
if($project && $project->exists()) {
$viewerGroups = $project->Viewers();
$groups = $viewerGroups->sort('Title')->map()->toArray();
$members = array();
foreach($viewerGroups as $group) {
foreach($group->Members()->map() as $k => $v) {
$members[$k] = $v;
}
}
asort($members);
} else {
$groups = array();
$members = array();
}
asort($members);

// Main tab
$fields->addFieldsToTab('Root.Main', array(
Expand Down

0 comments on commit 70e635a

Please sign in to comment.