Re-built organisation permissions
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
* SMTP server password: SMTP_PASSWORD
|
* SMTP server password: SMTP_PASSWORD
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
|
'debug' => [ 'auth' => true ],
|
||||||
'organisation' => [
|
'organisation' => [
|
||||||
'registration' => [
|
'registration' => [
|
||||||
'require_approval' => true,
|
'require_approval' => true,
|
||||||
@@ -25,5 +26,6 @@ return [
|
|||||||
'single_membership' => false,
|
'single_membership' => false,
|
||||||
'timeout' => -1,
|
'timeout' => -1,
|
||||||
],
|
],
|
||||||
|
'combine_action_buttons' => false,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -202,7 +202,10 @@ return [
|
|||||||
'DELETED' => 'Deleted',
|
'DELETED' => 'Deleted',
|
||||||
'RETURN' => 'Return',
|
'RETURN' => 'Return',
|
||||||
|
|
||||||
'JOIN' => 'Join',
|
'JOIN' => [
|
||||||
|
1 => 'Join',
|
||||||
|
'CANCEL' => 'Cancel join request',
|
||||||
|
],
|
||||||
'LEAVE' => 'Leave',
|
'LEAVE' => 'Leave',
|
||||||
|
|
||||||
'ACTION_CANNOT_UNDONE' => 'This action cannot be undone!',
|
'ACTION_CANNOT_UNDONE' => 'This action cannot be undone!',
|
||||||
|
|||||||
@@ -1116,19 +1116,22 @@ class OrganisationController extends SimpleController
|
|||||||
|
|
||||||
$tableColumns = [ 'description' ];
|
$tableColumns = [ 'description' ];
|
||||||
|
|
||||||
if ($currentUser->organisations(true)->count() == 0) {
|
if (
|
||||||
|
(
|
||||||
|
$currentUser->organisations(true)->count() == 0
|
||||||
|
|| !$config['organisation']['membership']['single_membership']
|
||||||
|
)
|
||||||
|
&& !$config['organisation']['combine_action_buttons']
|
||||||
|
) {
|
||||||
$tableColumns[] = 'join';
|
$tableColumns[] = 'join';
|
||||||
} else {
|
|
||||||
if (!$config['organisation']['membership']['single_membership']) {
|
|
||||||
$tableColumns[] = 'join';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($currentUser->organisations(true)->wherePivot('flag_admin', true) |
|
if ($currentUser->organisations(true)->wherePivot('flag_admin', true)
|
||||||
$authorizer->checkAccess($currentUser, 'delete_organisation') |
|
|| $authorizer->checkAccess($currentUser, 'delete_organisation')
|
||||||
$authorizer->checkAccess($currentUser, 'update_organisation_field') |
|
|| $authorizer->checkAccess($currentUser, 'update_organisation_field')
|
||||||
$authorizer->checkAccess($currentUser, 'approve_organisation') |
|
|| $authorizer->checkAccess($currentUser, 'approve_organisation')
|
||||||
$authorizer->checkAccess($currentUser, 'merge_organisations')) {
|
|| $authorizer->checkAccess($currentUser, 'merge_organisations')
|
||||||
|
|| $config['organisation']['combine_action_buttons']) {
|
||||||
$tableColumns[] = 'status';
|
$tableColumns[] = 'status';
|
||||||
$tableColumns[] = 'actions';
|
$tableColumns[] = 'actions';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
*/
|
*/
|
||||||
protected function getPermissions()
|
protected function getPermissions()
|
||||||
{
|
{
|
||||||
|
$roleIds = [
|
||||||
|
'user' => Role::where('slug', 'user')->first()->id,
|
||||||
|
'group-admin' => Role::where('slug', 'group-admin')->first()->id,
|
||||||
|
'site-admin' => Role::where('slug', 'site-admin')->first()->id,
|
||||||
|
'organisations-admin' => Role::where('slug', 'organisations-admin')->first()->id,
|
||||||
|
];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'create_organisation' => new Permission([
|
'create_organisation' => new Permission([
|
||||||
'slug' => 'create_organisation',
|
'slug' => 'create_organisation',
|
||||||
@@ -56,24 +63,19 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
'conditions' => "in(property,['name','slug','description'])",
|
'conditions' => "in(property,['name','slug','description'])",
|
||||||
'description' => 'View certain properties of any organisation.',
|
'description' => 'View certain properties of any organisation.',
|
||||||
]),
|
]),
|
||||||
'view_organisation_members_field' => new Permission([
|
|
||||||
'slug' => 'view_organisation_field',
|
|
||||||
'name' => 'View organisation members field',
|
|
||||||
'conditions' => "in(property,['members'])",
|
|
||||||
'description' => 'View members field of any organisation.',
|
|
||||||
]),
|
|
||||||
'view_organisation_members' => new Permission([
|
|
||||||
'slug' => 'view_organisation_members',
|
|
||||||
'name' => 'View organisation members',
|
|
||||||
'conditions' => "always()",
|
|
||||||
'description' => 'View members of any organisation.',
|
|
||||||
]),
|
|
||||||
'update_organisation_field' => new Permission([
|
'update_organisation_field' => new Permission([
|
||||||
'slug' => 'update_organisation_field',
|
'slug' => 'update_organisation_field',
|
||||||
'name' => 'Edit organisation',
|
'name' => 'Edit organisation',
|
||||||
'conditions' => 'always()',
|
'conditions' => 'always()',
|
||||||
'description' => 'Edit basic properties of any organisation.',
|
'description' => 'Edit basic properties of any organisation.',
|
||||||
]),
|
]),
|
||||||
|
'delete_organisation' => new Permission([
|
||||||
|
'slug' => 'delete_organisation',
|
||||||
|
'name' => 'Delete organisation',
|
||||||
|
'conditions' => 'always()',
|
||||||
|
'description' => 'Delete an organisation.',
|
||||||
|
]),
|
||||||
|
|
||||||
'approve_organisation' => new Permission([
|
'approve_organisation' => new Permission([
|
||||||
'slug' => 'approve_organisation',
|
'slug' => 'approve_organisation',
|
||||||
'name' => 'Approve/Deny organisation registration',
|
'name' => 'Approve/Deny organisation registration',
|
||||||
@@ -86,12 +88,6 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
'conditions' => 'always()',
|
'conditions' => 'always()',
|
||||||
'description' => 'Merge two organisations together, including all the members.',
|
'description' => 'Merge two organisations together, including all the members.',
|
||||||
]),
|
]),
|
||||||
'delete_organisation' => new Permission([
|
|
||||||
'slug' => 'delete_organisation',
|
|
||||||
'name' => 'Delete organisation',
|
|
||||||
'conditions' => 'always()',
|
|
||||||
'description' => 'Delete an organisation.',
|
|
||||||
]),
|
|
||||||
'restore_organisation' => new Permission([
|
'restore_organisation' => new Permission([
|
||||||
'slug' => 'restore_organisation',
|
'slug' => 'restore_organisation',
|
||||||
'name' => 'Restore organisation',
|
'name' => 'Restore organisation',
|
||||||
@@ -110,6 +106,46 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
'conditions' => "always()",
|
'conditions' => "always()",
|
||||||
'description' => 'Accept/Reject organisation join requests.',
|
'description' => 'Accept/Reject organisation join requests.',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
'uri_organisation' => new Permission([
|
||||||
|
'slug' => 'uri_organisation',
|
||||||
|
'name' => 'View organisation',
|
||||||
|
'conditions' => 'always()',
|
||||||
|
'description' => 'View the organisation page of any organisation.',
|
||||||
|
]),
|
||||||
|
'uri_organisations' => new Permission([
|
||||||
|
'slug' => 'uri_organisations',
|
||||||
|
'name' => 'Organisation management page',
|
||||||
|
'conditions' => 'always()',
|
||||||
|
'description' => 'View a page containing a list of organisations.',
|
||||||
|
]),
|
||||||
|
'uri_deleted_organisations' => new Permission([
|
||||||
|
'slug' => 'uri_deleted_organisations',
|
||||||
|
'name' => 'Deleted organisation management page',
|
||||||
|
'conditions' => 'always()',
|
||||||
|
'description' => 'View a page containing a list of deleted organisations.',
|
||||||
|
]),
|
||||||
|
|
||||||
|
|
||||||
|
// 'view_organisation_members_field' => new Permission([
|
||||||
|
// 'slug' => 'view_organisation_field',
|
||||||
|
// 'name' => 'View organisation members field',
|
||||||
|
// 'conditions' => "in(property,['members'])",
|
||||||
|
// 'description' => 'View members field of any organisation.',
|
||||||
|
// ]),
|
||||||
|
'view_organisation_members' => new Permission([
|
||||||
|
'slug' => 'view_organisation_field',
|
||||||
|
'name' => 'View organisation members',
|
||||||
|
'conditions' => "in(property,['members'])",
|
||||||
|
'description' => 'View members of any organisation.',
|
||||||
|
]),
|
||||||
|
'promote_organisation_member' => new Permission([
|
||||||
|
'slug' => 'promote_organisation_member',
|
||||||
|
'name' => 'Promote organisation member/Demote organisation administrator',
|
||||||
|
'conditions' => "is_organisation_member(user.id,organisation.id)",
|
||||||
|
'description' => 'Promote an organisation member to administrator status or demote an administrator to member status.',
|
||||||
|
]),
|
||||||
|
|
||||||
|
|
||||||
'register_organisation' => new Permission([
|
'register_organisation' => new Permission([
|
||||||
'slug' => 'register_organisation',
|
'slug' => 'register_organisation',
|
||||||
@@ -129,6 +165,15 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
'conditions' => 'always()',
|
'conditions' => 'always()',
|
||||||
'description' => 'Allows members to leave organisations.',
|
'description' => 'Allows members to leave organisations.',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
|
||||||
|
'uri_organisation_own' => new Permission([
|
||||||
|
'slug' => 'uri_organisation',
|
||||||
|
'name' => 'View own organisation',
|
||||||
|
'conditions' => 'is_organisation_member(self.id,organisation.id)',
|
||||||
|
'description' => 'View the organisation page of an organisation you are a member of.',
|
||||||
|
]),
|
||||||
|
|
||||||
'view_organisation_field_own' => new Permission([
|
'view_organisation_field_own' => new Permission([
|
||||||
'slug' => 'view_organisation_field',
|
'slug' => 'view_organisation_field',
|
||||||
'name' => 'View own organisation',
|
'name' => 'View own organisation',
|
||||||
@@ -147,76 +192,58 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
'conditions' => "is_organisation_admin(self.id,organisation.id)",
|
'conditions' => "is_organisation_admin(self.id,organisation.id)",
|
||||||
'description' => 'Accept/Reject organisation join requests.',
|
'description' => 'Accept/Reject organisation join requests.',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
'uri_organisation' => new Permission([
|
|
||||||
'slug' => 'uri_organisation',
|
|
||||||
'name' => 'View organisation',
|
|
||||||
'conditions' => 'always()',
|
|
||||||
'description' => 'View the organisation page of any organisation.',
|
|
||||||
]),
|
|
||||||
'uri_user' => new Permission([
|
|
||||||
'slug' => 'uri_user',
|
|
||||||
'name' => 'View organisation member',
|
|
||||||
'conditions' => 'can_admin_via_orgs(self.id, user.id)',
|
|
||||||
'description' => 'View the user page of any member of your organisation.',
|
|
||||||
]),
|
|
||||||
'uri_organisation_own' => new Permission([
|
|
||||||
'slug' => 'uri_organisation',
|
|
||||||
'name' => 'View own organisation',
|
|
||||||
'conditions' => 'is_organisation_member(self.id,organisation.id)',
|
|
||||||
'description' => 'View the organisation page of an organisation you are a member of.',
|
|
||||||
]),
|
|
||||||
'uri_organisations' => new Permission([
|
|
||||||
'slug' => 'uri_organisations',
|
|
||||||
'name' => 'Organisation management page',
|
|
||||||
'conditions' => 'always()',
|
|
||||||
'description' => 'View a page containing a list of organisations.',
|
|
||||||
]),
|
|
||||||
'uri_deleted_organisations' => new Permission([
|
|
||||||
'slug' => 'uri_deleted_organisations',
|
|
||||||
'name' => 'Deleted organisation management page',
|
|
||||||
'conditions' => 'always()',
|
|
||||||
'description' => 'View a page containing a list of deleted organisations.',
|
|
||||||
]),
|
|
||||||
|
|
||||||
'update_org_user_field' => new Permission([
|
|
||||||
'slug' => 'update_user_field',
|
|
||||||
'name' => 'Edit organisation member',
|
|
||||||
'conditions' => "subset(fields,['organisations'])",
|
|
||||||
'description' => 'Edit users who are in any organisation.',
|
|
||||||
]),
|
|
||||||
'view_org_user_field' => new Permission([
|
|
||||||
'slug' => 'view_user_field',
|
|
||||||
'name' => 'View organisation member',
|
|
||||||
'conditions' => "in(property,['organisations'])",
|
|
||||||
'description' => 'View certain properties of any user in any organisation.',
|
|
||||||
]),
|
|
||||||
|
|
||||||
'update_org_user_field_own' => new Permission([
|
|
||||||
'slug' => 'update_user_field',
|
|
||||||
'name' => 'Edit organisation member',
|
|
||||||
'conditions' => "can_admin_via_orgs(self.id, user.id) && subset(fields,['organisations'])",
|
|
||||||
'description' => 'Edit users who are in an organisation they are a member of.',
|
|
||||||
]),
|
|
||||||
'view_org_user_field_own' => new Permission([
|
|
||||||
'slug' => 'view_user_field',
|
|
||||||
'name' => 'View organisation member',
|
|
||||||
'conditions' => "similar_orgs(self.id, user.id) && in(property,['organisations'])",
|
|
||||||
'description' => 'View certain properties of any user in their organisation.',
|
|
||||||
]),
|
|
||||||
|
|
||||||
'promote_organisation_member' => new Permission([
|
|
||||||
'slug' => 'promote_organisation_member',
|
|
||||||
'name' => 'Promote organisation member/Demote organisation administrator',
|
|
||||||
'conditions' => "is_organisation_member(user.id,organisation.id) || is_organisation_admin(user.id,organisation.id)",
|
|
||||||
'description' => 'Promote an organisation member to administrator status or demote and administrator to member status.',
|
|
||||||
]),
|
|
||||||
'promote_organisation_member_own' => new Permission([
|
'promote_organisation_member_own' => new Permission([
|
||||||
'slug' => 'promote_organisation_member',
|
'slug' => 'promote_organisation_member',
|
||||||
'name' => 'Promote organisation member/Demote organisation administrator',
|
'name' => 'Promote organisation member/Demote organisation administrator',
|
||||||
'conditions' => "is_organisation_admin(self.id,organisation.id) && (is_organisation_member(user.id,organisation.id) || is_organisation_admin(user.id,organisation.id))",
|
'conditions' => "is_organisation_admin(self.id,organisation.id) && is_organisation_member(user.id,organisation.id)",
|
||||||
'description' => 'Promote an organisation member from your own organisation to administrator status or demote and administrator to member status.',
|
'description' => 'Promote an organisation member from your own organisation to administrator status or demote and administrator to member status.',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
|
||||||
|
// 'uri_user_in_organisation' => new Permission([
|
||||||
|
// 'slug' => 'uri_user',
|
||||||
|
// 'name' => 'View user',
|
||||||
|
// 'conditions' => "has_matching_organisation(self.id,user.id,true) && !is_master(user.id) && !has_role(user.id,{$roleIds['site-admin']}) && (!has_role(user.id,{$roleIds['organisations-admin']}) || equals_num(self.id,user.id))",
|
||||||
|
// 'description' => 'View the user page of any user in your group, except the master user and Site and (global) Organisation Administrators (except yourself).',
|
||||||
|
// ]),
|
||||||
|
'view_user_field' => new Permission([
|
||||||
|
'slug' => 'view_user_field',
|
||||||
|
'name' => 'View user',
|
||||||
|
'conditions' => "in(property,['organisations'])",
|
||||||
|
'description' => 'View the organisations property of any user.',
|
||||||
|
]),
|
||||||
|
'update_user_field' => new Permission([
|
||||||
|
'slug' => 'update_user_field',
|
||||||
|
'name' => 'Edit user',
|
||||||
|
'conditions' => "!has_role(user.id,{$roleIds['site-admin']}) && subset(fields,['organisations'])",
|
||||||
|
'description' => 'Edit organisations for users who are not Site Administrators.',
|
||||||
|
]),
|
||||||
|
|
||||||
|
'view_user_field_group' => new Permission([
|
||||||
|
'slug' => 'view_user_field',
|
||||||
|
'name' => 'View user',
|
||||||
|
'conditions' => "equals_num(self.group_id,user.group_id) && !is_master(user.id) && !has_role(user.id,{$roleIds['site-admin']}) && (!has_role(user.id,{$roleIds['group-admin']}) || equals_num(self.id,user.id)) && in(property,['organisations'])",
|
||||||
|
'description' => 'View organisations of any user in your own group, except the master user and Site and Group Administrators (except yourself).',
|
||||||
|
]),
|
||||||
|
'update_user_field_group' => new Permission([
|
||||||
|
'slug' => 'update_user_field',
|
||||||
|
'name' => 'Edit group user',
|
||||||
|
'conditions' => "equals_num(self.group_id,user.group_id) && !is_master(user.id) && !has_role(user.id,{$roleIds['site-admin']}) && (!has_role(user.id,{$roleIds['group-admin']}) || equals_num(self.id,user.id)) && subset(fields,['organisations'])",
|
||||||
|
'description' => 'Edit organisations for users in your own group who are not Site or Group Administrators, except yourself.',
|
||||||
|
]),
|
||||||
|
|
||||||
|
'view_user_field_organisation' => new Permission([
|
||||||
|
'slug' => 'view_user_field',
|
||||||
|
'name' => 'View user',
|
||||||
|
'conditions' => "has_matching_organisation(self.id,user.id) && !is_master(user.id) && !has_role(user.id,{$roleIds['site-admin']}) && (!has_role(user.id,{$roleIds['organisations-admin']}) || equals_num(self.id,user.id)) && in(property,['user_name','name','email','locale','roles','group','activities','organisations'])",
|
||||||
|
'description' => 'View certain properties of any user in your own organisation, except the master user and Site and (global) Organisation Administrators (except yourself).',
|
||||||
|
]),
|
||||||
|
'update_user_field_organisation' => new Permission([
|
||||||
|
'slug' => 'update_user_field',
|
||||||
|
'name' => 'Edit organisation user',
|
||||||
|
'conditions' => "has_matching_organisation(self.id,user.id,true) && !is_master(user.id) && !has_role(user.id,{$roleIds['site-admin']}) && (!has_role(user.id,{$roleIds['organisations-admin']}) || equals_num(self.id,user.id)) && subset(fields,['name','email','locale','flag_enabled','flag_verified','password'])",
|
||||||
|
'description' => 'Edit users in your own organisation who are not Site or (global) Organisation Administrators, except yourself.',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,45 +280,35 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
$roleSiteAdmin = Role::where('slug', 'site-admin')->first();
|
$roleSiteAdmin = Role::where('slug', 'site-admin')->first();
|
||||||
if ($roleSiteAdmin) {
|
if ($roleSiteAdmin) {
|
||||||
$roleSiteAdmin->permissions()->syncWithoutDetaching([
|
$roleSiteAdmin->permissions()->syncWithoutDetaching([
|
||||||
|
$permissions['view_user_field']->id,
|
||||||
|
$permissions['update_user_field']->id,
|
||||||
|
|
||||||
|
|
||||||
$permissions['create_organisation']->id,
|
$permissions['create_organisation']->id,
|
||||||
$permissions['approve_organisation']->id,
|
|
||||||
|
|
||||||
$permissions['view_organisation_field']->id,
|
$permissions['view_organisation_field']->id,
|
||||||
$permissions['view_organisation_members_field']->id,
|
|
||||||
$permissions['view_organisation_members']->id,
|
|
||||||
|
|
||||||
$permissions['update_organisation_field']->id,
|
$permissions['update_organisation_field']->id,
|
||||||
|
|
||||||
$permissions['merge_organisations']->id,
|
|
||||||
|
|
||||||
$permissions['delete_organisation']->id,
|
$permissions['delete_organisation']->id,
|
||||||
|
|
||||||
|
$permissions['approve_organisation']->id,
|
||||||
|
$permissions['merge_organisations']->id,
|
||||||
$permissions['restore_organisation']->id,
|
$permissions['restore_organisation']->id,
|
||||||
$permissions['permenent_delete_organisation']->id,
|
$permissions['permenent_delete_organisation']->id,
|
||||||
|
$permissions['accept_organisation_join_request']->id,
|
||||||
|
|
||||||
$permissions['uri_user']->id,
|
|
||||||
$permissions['uri_organisation']->id,
|
$permissions['uri_organisation']->id,
|
||||||
|
$permissions['uri_organisations']->id,
|
||||||
$permissions['uri_deleted_organisations']->id,
|
$permissions['uri_deleted_organisations']->id,
|
||||||
|
|
||||||
|
$permissions['view_organisation_members']->id,
|
||||||
$permissions['register_organisation']->id,
|
|
||||||
$permissions['join_organisation']->id,
|
|
||||||
$permissions['leave_organisation']->id,
|
|
||||||
|
|
||||||
$permissions['view_org_user_field_own']->id,
|
|
||||||
$permissions['update_org_user_field_own']->id,
|
|
||||||
$permissions['accept_organisation_join_request_own']->id,
|
|
||||||
$permissions['promote_organisation_member_own']->id,
|
|
||||||
|
|
||||||
$permissions['view_organisation_field_own']->id,
|
|
||||||
$permissions['update_organisation_field_own']->id,
|
|
||||||
|
|
||||||
$permissions['accept_organisation_join_request']->id,
|
|
||||||
$permissions['update_org_user_field']->id,
|
|
||||||
$permissions['view_org_user_field']->id,
|
|
||||||
$permissions['promote_organisation_member']->id,
|
$permissions['promote_organisation_member']->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$permissions['uri_organisation_own']->id,
|
$roleGroupAdmin = Role::where('slug', 'group-admin')->first();
|
||||||
$permissions['uri_organisations']->id,
|
if ($roleGroupAdmin) {
|
||||||
|
$roleGroupAdmin->permissions()->sync([
|
||||||
|
$permissions['view_user_field_group']->id,
|
||||||
|
$permissions['update_user_field_group']->id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,52 +316,25 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
if ($roleOrgAdmin) {
|
if ($roleOrgAdmin) {
|
||||||
$roleOrgAdmin->permissions()->syncWithoutDetaching([
|
$roleOrgAdmin->permissions()->syncWithoutDetaching([
|
||||||
$permissions['create_organisation']->id,
|
$permissions['create_organisation']->id,
|
||||||
$permissions['approve_organisation']->id,
|
|
||||||
|
|
||||||
$permissions['view_organisation_field']->id,
|
$permissions['view_organisation_field']->id,
|
||||||
$permissions['view_organisation_members_field']->id,
|
|
||||||
$permissions['view_organisation_members']->id,
|
|
||||||
|
|
||||||
$permissions['update_organisation_field']->id,
|
$permissions['update_organisation_field']->id,
|
||||||
|
|
||||||
$permissions['merge_organisations']->id,
|
|
||||||
|
|
||||||
$permissions['delete_organisation']->id,
|
$permissions['delete_organisation']->id,
|
||||||
|
|
||||||
|
$permissions['approve_organisation']->id,
|
||||||
|
$permissions['merge_organisations']->id,
|
||||||
$permissions['restore_organisation']->id,
|
$permissions['restore_organisation']->id,
|
||||||
$permissions['permenent_delete_organisation']->id,
|
$permissions['permenent_delete_organisation']->id,
|
||||||
|
$permissions['accept_organisation_join_request']->id,
|
||||||
|
|
||||||
$permissions['uri_user']->id,
|
|
||||||
$permissions['uri_organisation']->id,
|
$permissions['uri_organisation']->id,
|
||||||
|
$permissions['uri_organisations']->id,
|
||||||
$permissions['uri_deleted_organisations']->id,
|
$permissions['uri_deleted_organisations']->id,
|
||||||
|
|
||||||
|
$permissions['view_organisation_members']->id,
|
||||||
$permissions['register_organisation']->id,
|
|
||||||
$permissions['join_organisation']->id,
|
|
||||||
$permissions['leave_organisation']->id,
|
|
||||||
|
|
||||||
$permissions['view_org_user_field_own']->id,
|
|
||||||
$permissions['update_org_user_field_own']->id,
|
|
||||||
$permissions['accept_organisation_join_request_own']->id,
|
|
||||||
$permissions['promote_organisation_member_own']->id,
|
|
||||||
|
|
||||||
$permissions['view_organisation_field_own']->id,
|
|
||||||
$permissions['update_organisation_field_own']->id,
|
|
||||||
|
|
||||||
$permissions['accept_organisation_join_request']->id,
|
|
||||||
$permissions['update_org_user_field']->id,
|
|
||||||
$permissions['view_org_user_field']->id,
|
|
||||||
$permissions['promote_organisation_member']->id,
|
$permissions['promote_organisation_member']->id,
|
||||||
|
|
||||||
$permissions['uri_organisation_own']->id,
|
#$permissions['view_user_field']->id,
|
||||||
$permissions['uri_organisations']->id,
|
#$permissions['update_user_field']->id,
|
||||||
|
|
||||||
|
|
||||||
Permission::where('slug', 'create_user')->first()->id,
|
|
||||||
Permission::where('slug', 'delete_user')->first()->id,
|
|
||||||
Permission::where('slug', 'update_user_field')->where('conditions', "!has_role(user.id,{$roleSiteAdmin->id}) && subset(fields,['name','email','locale','group','flag_enabled','flag_verified','password'])")->first()->id,
|
|
||||||
|
|
||||||
Permission::where('slug', 'uri_users')->first()->id,
|
|
||||||
Permission::where('slug', 'uri_user')->where('conditions', 'always()')->first()->id,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,18 +345,16 @@ class OrganisationPermissions extends BaseSeed
|
|||||||
$permissions['join_organisation']->id,
|
$permissions['join_organisation']->id,
|
||||||
$permissions['leave_organisation']->id,
|
$permissions['leave_organisation']->id,
|
||||||
|
|
||||||
$permissions['view_org_user_field_own']->id,
|
|
||||||
$permissions['update_org_user_field_own']->id,
|
|
||||||
$permissions['accept_organisation_join_request_own']->id,
|
|
||||||
$permissions['promote_organisation_member_own']->id,
|
|
||||||
|
|
||||||
$permissions['view_organisation_field_own']->id,
|
$permissions['view_organisation_field_own']->id,
|
||||||
$permissions['update_organisation_field_own']->id,
|
$permissions['update_organisation_field_own']->id,
|
||||||
|
$permissions['accept_organisation_join_request_own']->id,
|
||||||
|
$permissions['promote_organisation_member_own']->id,
|
||||||
|
|
||||||
$permissions['uri_organisation_own']->id,
|
$permissions['uri_organisation_own']->id,
|
||||||
$permissions['uri_organisations']->id,
|
$permissions['uri_organisations']->id,
|
||||||
|
|
||||||
$permissions['uri_user']->id,
|
$permissions['view_user_field_organisation']->id,
|
||||||
|
$permissions['update_user_field_organisation']->id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class OrganisationRoles extends BaseSeed
|
|||||||
new Role([
|
new Role([
|
||||||
'slug' => 'organisations-admin',
|
'slug' => 'organisations-admin',
|
||||||
'name' => 'Organisations Administrator',
|
'name' => 'Organisations Administrator',
|
||||||
'description' => 'This role is meant for "organisation administrators", who can basically do anything related to organisations and their members.',
|
'description' => 'This role is meant for administrators who can basically do anything related to any organisations.',
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<script id="{{table.id}}-column-actions" type="text/x-handlebars-template">
|
<script id="{{table.id}}-column-actions" type="text/x-handlebars-template">
|
||||||
{% if 'actions' in table.columns %}
|
{% if 'actions' in table.columns %}
|
||||||
<td>
|
<td>
|
||||||
{% if not hasRole('organisation-admin') %}
|
{% if not organisationConfig.combine_action_buttons %}
|
||||||
{% verbatim %}{{#ifx row.is_admin '==' 1 }}{% endverbatim %}
|
{% if not (checkAccess('delete_organisation') or checkAccess('approve_organisation') or checkAccess('merge_organisations')) %}
|
||||||
|
{% verbatim %}{{#ifx row.is_admin '==' 1 }}{% endverbatim %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
@@ -11,45 +13,97 @@
|
|||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||||
<li>
|
|
||||||
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-edit">
|
|
||||||
<i class="fas fa-edit"></i>
|
{% if organisationConfig.combine_action_buttons %}
|
||||||
{{translate("ORGANISATION.EDIT")}}
|
{% verbatim %}{{#ifx row.is_pending '==' 1 }}{% endverbatim %}
|
||||||
</a>
|
<li>
|
||||||
</li>
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-cancelJoin">
|
||||||
|
<i class="fas fa-window-close"></i>
|
||||||
|
{{translate("JOIN.CANCEL")}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% verbatim %}{{ else }}{% endverbatim %}
|
||||||
|
{% verbatim %}{{#ifx row.is_member '==' 1 }}{% endverbatim %}
|
||||||
|
<li>
|
||||||
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-leave">
|
||||||
|
<i class="fas fa-sign-out-alt"></i>
|
||||||
|
{{translate("LEAVE")}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% verbatim %}{{ else }}{% endverbatim %}
|
||||||
|
{% if (organisationConfig.membership.single_membership == 0) or ((current_user.organisations.count == 0) and (current_user.pendingOrganisations.count == 0)) %}
|
||||||
|
<li>
|
||||||
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-join">
|
||||||
|
<i class="fas fa-sign-in-alt"></i>
|
||||||
|
{{translate("JOIN")}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% verbatim %}{{/ifx}}{% endverbatim %}
|
||||||
|
{% verbatim %}{{/ifx}}{% endverbatim %}
|
||||||
|
|
||||||
|
{% if checkAccess('merge_organisations') or checkAccess('approve_organisation') or checkAccess('delete_organisation') %}
|
||||||
|
<li class="divider"></li>
|
||||||
|
{% else %}
|
||||||
|
{% if organisationConfig.combine_action_buttons %}
|
||||||
|
{% if not (checkAccess('delete_organisation') or checkAccess('approve_organisation') or checkAccess('merge_organisations')) %}
|
||||||
|
{% verbatim %}{{#ifx row.is_admin '==' 1 }}<li class="divider"></li>{{/ifx}}{% endverbatim %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% if organisationConfig.combine_action_buttons %}
|
||||||
|
{% if not (checkAccess('delete_organisation') or checkAccess('approve_organisation') or checkAccess('merge_organisations')) %}
|
||||||
|
{% verbatim %}{{#ifx row.is_admin '==' 1 }}{% endverbatim %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<li>
|
||||||
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-edit">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
{{translate("ORGANISATION.EDIT")}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% if organisationConfig.combine_action_buttons %}
|
||||||
|
{% if not (checkAccess('delete_organisation') or checkAccess('approve_organisation') or checkAccess('merge_organisations')) %}
|
||||||
|
{% verbatim %}{{/ifx }}{% endverbatim %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if checkAccess('merge_organisations') %}
|
{% if checkAccess('merge_organisations') %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-merge">
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-merge">
|
||||||
<i class="fas fa-object-group"></i>
|
<i class="fas fa-object-group"></i>
|
||||||
{{translate("ORGANISATION.MERGE")}}
|
{{translate("ORGANISATION.MERGE")}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if checkAccess('approve_organisation') %}
|
{% if checkAccess('approve_organisation') %}
|
||||||
{% verbatim %}{{#ifx row.flag_approved '==' 0 }}{% endverbatim %}
|
{% verbatim %}{{#ifx row.flag_approved '==' 0 }}{% endverbatim %}
|
||||||
|
{% verbatim %}{{#ifx row.registrant_id '==' {% endverbatim %}{{current_user.id}}{% verbatim %} }}{% endverbatim %}
|
||||||
|
<li>
|
||||||
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-cancelRegistration">
|
||||||
|
<i class="fas fa-trash-alt"></i>
|
||||||
|
{{translate("ORGANISATION.REGISTRATION.CANCEL")}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% verbatim %}{{/ifx}}{% endverbatim %}
|
||||||
|
|
||||||
{% verbatim %}{{#ifx row.registrant_id '==' {% endverbatim %}{{current_user.id}}{% verbatim %} }}{% endverbatim %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-cancelRegistration">
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-approveRegistration">
|
||||||
<i class="fas fa-trash-alt"></i>
|
<i class="fas fa-thumbs-up"></i> {{translate("ORGANISATION.REGISTRATION.APPROVE")}}
|
||||||
{{translate("ORGANISATION.REGISTRATION.CANCEL")}}
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-denyRegistration">
|
||||||
|
<i class="fas fa-thumbs-down"></i>
|
||||||
|
{{translate("ORGANISATION.REGISTRATION.DENY")}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% verbatim %}{{/ifx}}{% endverbatim %}
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-approveRegistration">
|
|
||||||
<i class="fas fa-thumbs-up"></i> {{translate("ORGANISATION.REGISTRATION.APPROVE")}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#" data-slug="{% verbatim %}{{row.slug}}{% endverbatim %}" class="js-organisation-denyRegistration">
|
|
||||||
<i class="fas fa-thumbs-down"></i>
|
|
||||||
{{translate("ORGANISATION.REGISTRATION.DENY")}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% verbatim %}{{/ifx}}{% endverbatim %}
|
{% verbatim %}{{/ifx}}{% endverbatim %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -66,8 +120,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not hasRole('organisation-admin') %}
|
{% if not organisationConfig.combine_action_buttons %}
|
||||||
{% verbatim %}{{/ifx}}{% endverbatim %}
|
{% if not (checkAccess('delete_organisation') or checkAccess('approve_organisation') or checkAccess('merge_organisations')) %}
|
||||||
|
{% verbatim %}{{/ifx}}{% endverbatim %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script id="{{table.id}}-column-adminCount" type="text/x-handlebars-template">
|
<script id="{{table.id}}-column-adminCount" type="text/x-handlebars-template">
|
||||||
{% if checkAccess('view_organisation_members') %}
|
{% if checkAccess('view_organisation_field', { 'property' : 'members' }) %}
|
||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
<td>
|
<td>
|
||||||
{{row.admin_count}}
|
{{row.admin_count}}
|
||||||
|
|||||||
@@ -1,27 +1,29 @@
|
|||||||
<script id="{{table.id}}-column-join" type="text/x-handlebars-template">
|
<script id="{{table.id}}-column-join" type="text/x-handlebars-template">
|
||||||
{% if 'join' in table.columns %}
|
{% if not organisationConfig.combine_action_buttons %}
|
||||||
{% verbatim %}
|
{% if 'join' in table.columns %}
|
||||||
<td>
|
{% verbatim %}
|
||||||
<div class="btn-group">
|
<td>
|
||||||
{{#ifx row.is_pending '==' 1 }}
|
<div class="btn-group">
|
||||||
<button type="button" data-slug="{{row.slug}}" class="btn btn-danger js-organisation-cancelJoin" style="min-width: 70px">
|
{{#ifx row.is_pending '==' 1 }}
|
||||||
{% endverbatim %}{{translate("CANCEL")}}{% verbatim %}
|
<button type="button" data-slug="{{row.slug}}" class="btn btn-danger js-organisation-cancelJoin" style="min-width: 70px">
|
||||||
</button>
|
{% endverbatim %}{{translate("CANCEL")}}{% verbatim %}
|
||||||
{{ else }}
|
|
||||||
{{#ifx row.is_member '==' 1 }}
|
|
||||||
<button type="button" data-slug="{{row.slug}}" class="btn btn-danger js-organisation-leave" style="min-width: 70px">
|
|
||||||
{% endverbatim %}{{translate("LEAVE")}}{% verbatim %}
|
|
||||||
</button>
|
</button>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{% endverbatim %}{% if (organisationConfig.membership.single_membership == 0) or ((current_user.organisations.count == 0) and (current_user.pendingOrganisations.count == 0)) %}{% verbatim %}
|
{{#ifx row.is_member '==' 1 }}
|
||||||
<button type="button" data-slug="{{row.slug}}" class="btn btn-success js-organisation-join" style="min-width: 70px">
|
<button type="button" data-slug="{{row.slug}}" class="btn btn-danger js-organisation-leave" style="min-width: 70px">
|
||||||
{% endverbatim %}{{translate("JOIN")}}{% verbatim %}
|
{% endverbatim %}{{translate("LEAVE")}}{% verbatim %}
|
||||||
</button>
|
</button>
|
||||||
{% endverbatim %}{% endif %}{% verbatim %}
|
{{ else }}
|
||||||
|
{% endverbatim %}{% if (organisationConfig.membership.single_membership == 0) or ((current_user.organisations.count == 0) and (current_user.pendingOrganisations.count == 0)) %}{% verbatim %}
|
||||||
|
<button type="button" data-slug="{{row.slug}}" class="btn btn-success js-organisation-join" style="min-width: 70px">
|
||||||
|
{% endverbatim %}{{translate("JOIN")}}{% verbatim %}
|
||||||
|
</button>
|
||||||
|
{% endverbatim %}{% endif %}{% verbatim %}
|
||||||
|
{{/ifx}}
|
||||||
{{/ifx}}
|
{{/ifx}}
|
||||||
{{/ifx}}
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
{% endverbatim %}
|
||||||
{% endverbatim %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script id="{{table.id}}-column-memberCount" type="text/x-handlebars-template">
|
<script id="{{table.id}}-column-memberCount" type="text/x-handlebars-template">
|
||||||
{% if checkAccess('view_organisation_members') %}
|
{% if checkAccess('view_organisation_field', { 'property' : 'members' }) %}
|
||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
<td>
|
<td>
|
||||||
{{row.member_count}}
|
{{row.member_count}}
|
||||||
|
|||||||
@@ -18,13 +18,15 @@
|
|||||||
{% if 'status' in table.columns %}
|
{% if 'status' in table.columns %}
|
||||||
<th class="filter-select filter-metatext" data-column-name="status" data-column-template="#{{table.id}}-column-status" data-priority="2">{{translate("STATUS")}} <i class="fas fa-sort"></i></th>
|
<th class="filter-select filter-metatext" data-column-name="status" data-column-template="#{{table.id}}-column-status" data-priority="2">{{translate("STATUS")}} <i class="fas fa-sort"></i></th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if checkAccess('view_organisation_members') %}
|
{% if checkAccess('view_organisation_field', { 'property' : 'members' }) %}
|
||||||
<th class="sorter-metanum" data-column-name="member_count" data-column-template="#{{table.id}}-column-memberCount" data-priority="2" style="min-width: 180px">{{translate("ORGANISATION.MEMBER_COUNT")}} <i class="fas fa-sort"></i></th>
|
<th class="sorter-metanum" data-column-name="member_count" data-column-template="#{{table.id}}-column-memberCount" data-priority="2" style="min-width: 180px">{{translate("ORGANISATION.MEMBER_COUNT")}} <i class="fas fa-sort"></i></th>
|
||||||
<th class="sorter-metanum" data-column-name="admin_count" data-column-template="#{{table.id}}-column-adminCount" data-priority="2">{{translate("ORGANISATION.ADMIN_COUNT")}} <i class="fas fa-sort"></i></th>
|
<th class="sorter-metanum" data-column-name="admin_count" data-column-template="#{{table.id}}-column-adminCount" data-priority="2">{{translate("ORGANISATION.ADMIN_COUNT")}} <i class="fas fa-sort"></i></th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if not organisationConfig.combine_action_buttons %}
|
||||||
{% if 'join' in table.columns %}
|
{% if 'join' in table.columns %}
|
||||||
<th data-column-template="#{{table.id}}-column-join" data-column-name="join" data-sorter="false" data-filter="false" data-priority="3">{{translate("JOIN")}}/{{translate("LEAVE")}}</th>
|
<th data-column-template="#{{table.id}}-column-join" data-column-name="join" data-sorter="false" data-filter="false" data-priority="3">{{translate("JOIN")}}/{{translate("LEAVE")}}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if 'actions' in table.columns %}
|
{% if 'actions' in table.columns %}
|
||||||
<th data-column-template="#{{table.id}}-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate("ACTIONS")}}</th>
|
<th data-column-template="#{{table.id}}-column-actions" data-sorter="false" data-filter="false" data-priority="1">{{translate("ACTIONS")}}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user