Skip to content

Commit 6d950a2

Browse files
authored
Merge pull request #25 from creecros/pm-addgroup
Pm addgroup
2 parents c32f070 + c994c74 commit 6d950a2

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

Plugin.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Kanboard\Plugin\Group_assign\Model\TaskRecurrenceModel;
2525
use PicoDb\Table;
2626
use PicoDb\Database;
27+
use Kanboard\Core\Security\Role;
2728

2829
class Plugin extends Base
2930
{
@@ -149,6 +150,17 @@ public function initialize()
149150
$model = new GroupAssignCalendarModel($container);
150151
return $model->getUserCalendarEvents($user_id, $start, $end); // Return new events
151152
});
153+
154+
//Roles
155+
156+
$this->template->hook->attach('template:config:application', 'group_assign:config/toggle');
157+
158+
if ($this->configModel->get('enable_am_group_management', '2') == 1) {
159+
$this->applicationAccessMap->add('GroupListController', '*', Role::APP_MANAGER);
160+
$this->applicationAccessMap->add('GroupCreationController', '*', Role::APP_MANAGER);
161+
$this->template->setTemplateOverride('header/user_dropdown', 'group_assign:header/user_dropdown');
162+
}
163+
152164

153165
}
154166

@@ -175,7 +187,7 @@ public function getPluginAuthor()
175187
}
176188
public function getPluginVersion()
177189
{
178-
return '1.5.0';
190+
return '1.6.0';
179191
}
180192
public function getPluginHomepage()
181193
{

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Kanboard v1.1.0 or Higher
3333
* Duplicating Tasks will include assigned groups and other users.
3434
* Duplicating to another project or moving to another project will check permissions of assignees, and remove those without permission.
3535
* Task Reccurences will include group assigned and other assignees in the recurrence.
36+
* Setting included to enable group managment for Application Managers
37+
* Found in `Settings > Application settings`
3638

3739
# Future enhancments
3840
Find bugs or missing functionality, please report it.

Template/config/toggle.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="panel">
2+
<?= $this->form->radio('enable_am_group_management', 'Enable Group Managment for Application Managers' , 1, isset($values['enable_am_group_management'])&& $values['enable_am_group_management']==1) ?>
3+
<?= $this->form->radio('enable_am_group_management', 'Disable Group Managment for Application Managers' , 2, isset($values['enable_am_group_management'])&& $values['enable_am_group_management']==2) ?>
4+
</div>

Template/header/user_dropdown.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<div class="dropdown">
2+
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><?= $this->avatar->currentUserSmall('avatar-inline') ?><i class="fa fa-caret-down"></i></a>
3+
<ul>
4+
<li class="no-hover"><strong><?= $this->text->e($this->user->getFullname()) ?></strong></li>
5+
<li>
6+
<?= $this->url->icon('tachometer', t('My dashboard'), 'DashboardController', 'show', array('user_id' => $this->user->getId())) ?>
7+
</li>
8+
<li>
9+
<?= $this->url->icon('home', t('My profile'), 'UserViewController', 'show', array('user_id' => $this->user->getId())) ?>
10+
</li>
11+
<li>
12+
<?= $this->url->icon('folder', t('Projects management'), 'ProjectListController', 'show') ?>
13+
</li>
14+
<?php if ($this->user->hasAccess('GroupListController', 'index') && $_SESSION['user']['role'] == 'app-manager'): ?>
15+
<li>
16+
<?= $this->url->icon('group', t('Groups management'), 'GroupListController', 'index') ?>
17+
</li>
18+
<?php endif ?>
19+
<?php if ($this->user->hasAccess('UserListController', 'show')): ?>
20+
<li>
21+
<?= $this->url->icon('user', t('Users management'), 'UserListController', 'show') ?>
22+
</li>
23+
<li>
24+
<?= $this->url->icon('group', t('Groups management'), 'GroupListController', 'index') ?>
25+
</li>
26+
<li>
27+
<?= $this->url->icon('cubes', t('Plugins'), 'PluginController', 'show') ?>
28+
</li>
29+
<li>
30+
<?= $this->url->icon('cog', t('Settings'), 'ConfigController', 'index') ?>
31+
</li>
32+
<?php endif ?>
33+
34+
<?= $this->hook->render('template:header:dropdown') ?>
35+
36+
<li>
37+
<i class="fa fa-fw fa-life-ring" aria-hidden="true"></i>
38+
<?= $this->url->doc(t('Documentation'), 'index') ?>
39+
</li>
40+
<?php if (! DISABLE_LOGOUT): ?>
41+
<li>
42+
<?= $this->url->icon('sign-out', t('Logout'), 'AuthController', 'logout') ?>
43+
</li>
44+
<?php endif ?>
45+
</ul>
46+
</div>

0 commit comments

Comments
 (0)