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:
parent
e1a8646e5f
commit
c30ae8179e
@ -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;
|
||||
|
@ -49,7 +49,8 @@ class API::UsersController < API::ApiController
|
||||
|
||||
def manager_params
|
||||
params.require(:manager).permit(
|
||||
:username, :email, :group_id, :tag_ids,
|
||||
: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]
|
||||
|
@ -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?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user