Remove feature "Allow everybody to access to this project"

This commit is contained in:
Frederic Guillot
2017-10-27 16:16:11 -07:00
parent 0b9c3b0a5b
commit cc6618901b
47 changed files with 53 additions and 320 deletions

View File

@@ -59,25 +59,6 @@ class ProjectPermissionController extends BaseController
)));
}
/**
* Allow everybody
*
* @access public
*/
public function allowEverybody()
{
$project = $this->getProject();
$values = $this->request->getValues() + array('is_everybody_allowed' => 0);
if ($this->projectModel->update($values)) {
$this->flash->success(t('Project updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this project.'));
}
$this->response->redirect($this->helper->url->to('ProjectPermissionController', 'index', array('project_id' => $project['id'])));
}
/**
* Add user to the project
*

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Spisak aktivnosti',
'Dashboard' => 'Panel',
'Confirmation' => 'Potvrda',
'Allow everybody to access to this project' => 'Dozvoli svima pristup ovom projektu',
'Everybody have access to this project.' => 'Svima je dozvoljen pristup ovom projektu.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Napravi komentar preko vanjskog posrednika',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Fluxe d\'activitat',
'Dashboard' => 'Panell',
'Confirmation' => 'Confirmació',
'Allow everybody to access to this project' => 'Deixa que tothom per accedir a aquest projecte',
'Everybody have access to this project.' => 'Tothom té accés a aquest projecte.',
'Webhooks' => 'WebHooks',
'API' => 'API',
'Create a comment from an external provider' => 'Crear un comentari d\'un proveïdor extern',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Přehled aktivit',
'Dashboard' => 'Nástěnka',
'Confirmation' => 'Potvrzení',
'Allow everybody to access to this project' => 'Umožní přístup komukoliv k tomuto projektu',
'Everybody have access to this project.' => 'Přístup k tomuto projektu má kdokoliv.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Vytvořit komentář pomocí externího poskytovatele',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Aktivitets strøm',
'Dashboard' => 'Dashboard',
'Confirmation' => 'Bekræftelse',
'Allow everybody to access to this project' => 'Tillad adgang for alle til dette projekt',
'Everybody have access to this project.' => 'Alle har adgang til dette projekt',
// 'Webhooks' => '',
// 'API' => '',
// 'Create a comment from an external provider' => '',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Letzte Aktivitäten',
'Dashboard' => 'Dashboard',
'Confirmation' => 'Wiederholung',
'Allow everybody to access to this project' => 'Jedem Zugriff zu diesem Projekt gewähren',
'Everybody have access to this project.' => 'Jeder hat Zugriff zu diesem Projekt',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Kommentar eines externen Providers hinzufügen',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Ροή δραστηριότητας',
'Dashboard' => 'Κεντρικό ταμπλό',
'Confirmation' => 'Επιβεβαίωση',
'Allow everybody to access to this project' => 'Να επιτρέπετε σε όλους να έχουν πρόσβαση σε αυτό το έργο',
'Everybody have access to this project.' => 'Όλοι έχουν πρόσβαση σε αυτό το έργο.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Δημιουργήστε ένα σχόλιο από έναν εξωτερικό πάροχο',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Flujo de actividad',
'Dashboard' => 'Tablero',
'Confirmation' => 'Confirmación',
'Allow everybody to access to this project' => 'Permitir a cualquier acceder a este proyecto',
'Everybody have access to this project.' => 'Cualquier tiene acceso a este proyecto',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Crear un comentario a partir de un proveedor externo',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Toiminta',
'Dashboard' => 'Työpöytä',
'Confirmation' => 'Vahvistus',
'Allow everybody to access to this project' => 'Anna kaikille käyttöoikeus tähän projektiin',
'Everybody have access to this project.' => 'Kaikilla on käyttöoikeus projektiin.',
// 'Webhooks' => '',
// 'API' => '',
// 'Create a comment from an external provider' => '',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Flux d\'activité',
'Dashboard' => 'Tableau de bord',
'Confirmation' => 'Confirmation',
'Allow everybody to access to this project' => 'Autoriser tout le monde à accéder à ce projet',
'Everybody have access to this project.' => 'Tout le monde a accès à ce projet.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Créer un commentaire depuis un fournisseur externe',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Popis aktivnosti',
'Dashboard' => 'Nadzorna ploča',
'Confirmation' => 'Potvrda',
'Allow everybody to access to this project' => 'Dozvoli svima pristup projektu',
'Everybody have access to this project.' => 'Svima je dozvoljen pristup.',
// 'Webhooks' => '',
// 'API' => '',
// 'Create a comment from an external provider' => '',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Legutóbbi tevékenységek',
'Dashboard' => 'Vezérlőpult',
'Confirmation' => 'Megerősítés',
'Allow everybody to access to this project' => 'A projekt elérése mindenkinek engedélyezett',
'Everybody have access to this project.' => 'Mindenki elérheti a projektet',
'Webhooks' => 'Webhook',
'API' => 'API',
'Create a comment from an external provider' => 'Megjegyzés létrehozása külső felhasználótól',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Arus aktifitas',
'Dashboard' => 'Dasbor',
'Confirmation' => 'Konfirmasi',
'Allow everybody to access to this project' => 'Izinkan semua orang untuk mengakses proyek ini',
'Everybody have access to this project.' => 'Semua orang mendapat akses untuk proyek ini.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Buat komentar dari penyedia eksternal',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Flusso attività',
'Dashboard' => 'Bacheca',
'Confirmation' => 'Conferma',
'Allow everybody to access to this project' => 'Abilita tutti ad accedere a questo progetto',
'Everybody have access to this project.' => 'Tutti hanno accesso a questo progetto.',
// 'Webhooks' => '',
// 'API' => '',
'Create a comment from an external provider' => 'Crea un commit da un provider esterno',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'アクティビティストリーム',
'Dashboard' => 'ダッシュボード',
'Confirmation' => '確認',
'Allow everybody to access to this project' => '全員にプロジェクトへのアクセスを許す',
'Everybody have access to this project.' => '誰でもこのプロジェクトにアクセスできます',
'Webhooks' => 'Webhook',
'API' => 'API',
'Create a comment from an external provider' => '外部サービスからコメントを作成する',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => '활동기록',
'Dashboard' => '대시보드',
'Confirmation' => '확인',
'Allow everybody to access to this project' => '모든 사람이 이 프로젝트에 접근할 수 있도록 합니다',
'Everybody have access to this project.' => '누구나 이 프로젝트에 액세스 할 수 있습니다',
'Webhooks' => 'Webhook',
'API' => 'API',
'Create a comment from an external provider' => '외부 서비스로부터 의견을 작성한다',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Arus aktifitas',
'Dashboard' => 'Dasbor',
'Confirmation' => 'Konfirmasi',
'Allow everybody to access to this project' => 'Memungkinkan semua orang untuk mengakses projek ini',
'Everybody have access to this project.' => 'Semua orang mendapat akses untuk projek ini.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Buat komentar dari pemasok eksternal',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Aktivitetslogg',
'Dashboard' => 'Hovedsiden',
'Confirmation' => 'Bekreftelse',
'Allow everybody to access to this project' => 'Gi alle tilgang til dette prosjektet',
'Everybody have access to this project.' => 'Alle har tilgang til dette prosjektet',
// 'Webhooks' => '',
// 'API' => '',
'Create a comment from an external provider' => 'Opprett en kommentar fra en ekstern tilbyder',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Activiteiten',
'Dashboard' => 'Dashboard',
// 'Confirmation' => '',
'Allow everybody to access to this project' => 'Geef iedereen toegang tot dit project',
'Everybody have access to this project.' => 'Iedereen heeft toegang tot dit project.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Voeg een commentaar toe van een externe provider',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Strumień aktywności',
'Dashboard' => 'Dashboard',
'Confirmation' => 'Potwierdzenie',
'Allow everybody to access to this project' => 'Udostępnij ten projekt wszystkim',
'Everybody have access to this project.' => 'Wszyscy mają dostęp do tego projektu.',
'Webhooks' => 'Webhooki',
// 'API' => '',
'Create a comment from an external provider' => 'Utwórz komentarz od zewnętrznego dostawcy',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Atividades Recentes',
'Dashboard' => 'Painel de Controle',
'Confirmation' => 'Confirmação',
'Allow everybody to access to this project' => 'Permitir que todos acessem este projeto',
'Everybody have access to this project.' => 'Todos possuem acesso a este projeto.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Criar um comentário por meio de um serviço externo',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Atividades Recentes',
'Dashboard' => 'Painel de Controlo',
'Confirmation' => 'Confirmação',
'Allow everybody to access to this project' => 'Permitir a todos os acesso a este projeto',
'Everybody have access to this project.' => 'Todos possuem acesso a este projeto.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Criar um comentário por meio de um serviço externo',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Текущая активность',
'Dashboard' => 'Панель управления',
'Confirmation' => 'Подтверждение пароля',
'Allow everybody to access to this project' => 'Разрешить любому',
'Everybody have access to this project.' => 'Любой может получить доступ к этому проекту.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Создать комментарий из внешнего источника',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Spisak aktinosti',
'Dashboard' => 'Panel',
'Confirmation' => 'Potvrda',
'Allow everybody to access to this project' => 'Dozvoli svima pristup projektu',
'Everybody have access to this project.' => 'Svima je dozvoljen pristup.',
// 'Webhooks' => '',
// 'API' => '',
// 'Create a comment from an external provider' => '',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Aktivitetsström',
'Dashboard' => 'Instrumentpanel',
'Confirmation' => 'Bekräftelse',
'Allow everybody to access to this project' => 'Ge alla tillgång till projektet',
'Everybody have access to this project.' => 'Alla har tillgång till projektet',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Skapa en kommentar från en extern leverantör',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'กิจกรรมที่เกิดขึ้น',
'Dashboard' => 'แดชบอร์ด',
'Confirmation' => 'ยืนยันรหัสผ่าน',
'Allow everybody to access to this project' => 'อนุญาตให้ทุกคนเข้าถึงโปรเจคนี้',
'Everybody have access to this project.' => 'ทุกคนสามารถเข้าถึงโปรเจคนี้',
// 'Webhooks' => '',
// 'API' => '',
'Create a comment from an external provider' => 'สร้างความคิดเห็นจากบริการภายนอก',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Güncel olay akışı',
'Dashboard' => 'Pano',
'Confirmation' => 'Onay',
'Allow everybody to access to this project' => 'Bu projeye herkesin erişimine izin ver',
'Everybody have access to this project.' => 'Bu projeye herkesin erişimi var.',
'Webhooks' => 'Web Kancaları',
'API' => 'API',
'Create a comment from an external provider' => 'Dış sağlayıcı ile bir yorum oluştur',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => 'Luồng hoạt động',
'Dashboard' => 'Bảng điều khiển',
'Confirmation' => 'Xác nhận',
'Allow everybody to access to this project' => 'Cho phép mọi người truy cập vào dự án này',
'Everybody have access to this project.' => 'Mọi người đều có quyền truy cập vào dự án này.',
'Webhooks' => 'Webhooks',
'API' => 'API',
'Create a comment from an external provider' => 'Tạo một bình luận từ một nhà cung cấp bên ngoài',

View File

@@ -394,8 +394,6 @@ return array(
'Activity stream' => '动态记录',
'Dashboard' => '面板',
'Confirmation' => '确认',
'Allow everybody to access to this project' => '允许所有人访问此项目',
'Everybody have access to this project.' => '所有人都可以访问此项目',
'Webhooks' => '网络钩子',
'API' => '应用程序接口',
'Create a comment from an external provider' => '从外部创建一个评论',

View File

@@ -111,22 +111,6 @@ class ProjectPermissionModel extends Base
});
}
/**
* Return true if everybody is allowed for the project
*
* @access public
* @param integer $project_id Project id
* @return bool
*/
public function isEverybodyAllowed($project_id)
{
return $this->db
->table(ProjectModel::TABLE)
->eq('id', $project_id)
->eq('is_everybody_allowed', 1)
->exists();
}
/**
* Return true if the user is allowed to access a project
*

View File

@@ -44,10 +44,7 @@ class ProjectUserRoleModel extends Base
{
$userProjects = $this->db
->hashtable(ProjectModel::TABLE)
->beginOr()
->eq(self::TABLE.'.user_id', $user_id)
->eq(ProjectModel::TABLE.'.is_everybody_allowed', 1)
->closeOr()
->in(ProjectModel::TABLE.'.is_active', $status)
->join(self::TABLE, 'project_id', 'id')
->getAll(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name');
@@ -70,15 +67,6 @@ class ProjectUserRoleModel extends Base
*/
public function getUserRole($project_id, $user_id)
{
$projectInfo = $this->db->table(ProjectModel::TABLE)
->eq('id', $project_id)
->columns('owner_id', 'is_everybody_allowed')
->findOne();
if ($projectInfo['is_everybody_allowed'] == 1) {
return $projectInfo['owner_id'] == $user_id ? Role::PROJECT_MANAGER : Role::PROJECT_MEMBER;
}
$role = $this->db->table(self::TABLE)->eq('user_id', $user_id)->eq('project_id', $project_id)->findOneColumn('role');
if (empty($role)) {
@@ -163,10 +151,6 @@ class ProjectUserRoleModel extends Base
*/
public function getAssignableUsers($project_id)
{
if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) {
return $this->userModel->getActiveUsersList();
}
$userMembers = $this->db->table(self::TABLE)
->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')
->join(UserModel::TABLE, 'id', 'user_id')

View File

@@ -68,10 +68,6 @@ class UserNotificationModel extends Base
*/
public function getUsersWithNotificationEnabled($project_id, $exclude_user_id = 0)
{
if ($this->projectPermissionModel->isEverybodyAllowed($project_id)) {
return $this->getEverybodyWithNotificationEnabled($exclude_user_id);
}
$users = array();
$members = $this->getProjectUserMembersWithNotificationEnabled($project_id, $exclude_user_id);
$groups = $this->getProjectGroupMembersWithNotificationEnabled($project_id, $exclude_user_id);
@@ -183,22 +179,4 @@ class UserNotificationModel extends Base
->eq(UserModel::TABLE.'.is_active', 1)
->findAll();
}
/**
* Get a list of project members with notification enabled
*
* @access private
* @param integer $exclude_user_id User id to exclude
* @return array
*/
private function getEverybodyWithNotificationEnabled($exclude_user_id)
{
return $this->db
->table(UserModel::TABLE)
->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter')
->eq('notifications_enabled', '1')
->neq(UserModel::TABLE.'.id', $exclude_user_id)
->eq(UserModel::TABLE.'.is_active', 1)
->findAll();
}
}

View File

@@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
const VERSION = 124;
const VERSION = 125;
function version_125(PDO $pdo)
{
$pdo->exec('ALTER TABLE projects DROP COLUMN is_everybody_allowed');
}
function version_124(PDO $pdo)
{

View File

@@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
const VERSION = 103;
const VERSION = 104;
function version_104(PDO $pdo)
{
$pdo->exec('ALTER TABLE projects DROP COLUMN is_everybody_allowed');
}
function version_103(PDO $pdo)
{

View File

@@ -2,36 +2,18 @@
<h2><?= t('Allowed Users') ?></h2>
</div>
<?php if ($project['is_everybody_allowed']): ?>
<div class="alert"><?= t('Everybody have access to this project.') ?></div>
<?php else: ?>
<?= $this->render('project_permission/users', array(
'project' => $project,
'roles' => $roles,
'users' => $users,
'errors' => $errors,
'values' => $values,
)) ?>
<?= $this->render('project_permission/users', array(
'project' => $project,
'roles' => $roles,
'users' => $users,
'errors' => $errors,
'values' => $values,
)) ?>
<?= $this->render('project_permission/groups', array(
'project' => $project,
'roles' => $roles,
'groups' => $groups,
'errors' => $errors,
'values' => $values,
)) ?>
<?php endif ?>
<?php if ($project['is_private'] == 0): ?>
<hr/>
<form method="post" action="<?= $this->url->href('ProjectPermissionController', 'allowEverybody', array('project_id' => $project['id'])) ?>">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', array('id' => $project['id'])) ?>
<?= $this->form->checkbox('is_everybody_allowed', t('Allow everybody to access to this project'), 1, $project['is_everybody_allowed']) ?>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
</div>
</form>
<?php endif ?>
<?= $this->render('project_permission/groups', array(
'project' => $project,
'roles' => $roles,
'groups' => $groups,
'errors' => $errors,
'values' => $values,
)) ?>