1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

fix groups and tags in manager creation + helpers to get users w/ role partner|manager

This commit is contained in:
Sylvain 2020-04-22 10:46:46 +02:00
parent e1a8646e5f
commit c30ae8179e
3 changed files with 14 additions and 5 deletions

View File

@ -1096,7 +1096,7 @@ Application.Controllers.controller('NewManagerController', ['$state', '$scope',
};
// list of all groups
$scope.groups = groupsPromise;
$scope.groups = groupsPromise.filter(function (g) { return (g.slug !== 'admins') && !g.disabled; });
// list of all tags
$scope.tags = tagsPromise;

View File

@ -49,10 +49,11 @@ class API::UsersController < API::ApiController
def manager_params
params.require(:manager).permit(
:username, :email, :group_id, :tag_ids,
profile_attributes: %i[first_name last_name phone],
invoicing_profile_attributes: [address_attributes: [:address]],
statistic_profile_attributes: %i[gender birthday]
:username, :email, :group_id,
tag_ids: [],
profile_attributes: %i[first_name last_name phone],
invoicing_profile_attributes: [address_attributes: [:address]],
statistic_profile_attributes: %i[gender birthday]
)
end
end

View File

@ -97,6 +97,14 @@ class User < ApplicationRecord
User.with_role(:member)
end
def self.partners
User.with_role(:partner)
end
def self.managers
User.with_role(:manager)
end
def self.superadmin
return unless Rails.application.secrets.superadmin_email.present?