1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

renamed SUPERADMIN_EMAIL to ADMINSYS_EMAIL

The previous was too much subject to confusions
This commit is contained in:
Sylvain 2021-04-14 15:04:41 +02:00
parent 4d3ead310d
commit 07ea6e8c69
13 changed files with 50 additions and 23 deletions

View File

@ -158,7 +158,7 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
}; };
// admins list // admins list
$scope.admins = adminsPromise.admins.filter(function (m) { return m.id !== Fablab.superadminId; }); $scope.admins = adminsPromise.admins.filter(function (m) { return m.id !== Fablab.adminSysId; });
// Admins ordering/sorting. Default: not sorted // Admins ordering/sorting. Default: not sorted
$scope.orderAdmin = null; $scope.orderAdmin = null;

View File

@ -125,8 +125,8 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
} }
}; };
// This boolean value will tell if the current user is the super-admin // This boolean value will tell if the current user is the system admin
$scope.isSuperAdmin = memberPromise.id === Fablab.superadminId; $scope.isAdminSys = memberPromise.id === Fablab.adminSysId;
/** /**
* Return the group object, identified by the ID set in $scope.userGroup * Return the group object, identified by the ID set in $scope.userGroup

View File

@ -5,7 +5,7 @@ export interface IFablab {
statisticsModule: boolean, statisticsModule: boolean,
defaultHost: string, defaultHost: string,
trackingId: string, trackingId: string,
superadminId: number, adminSysId: number,
baseHostUrl: string, baseHostUrl: string,
locale: string, locale: string,
moment_locale: string, moment_locale: string,

View File

@ -84,7 +84,7 @@
<div ng-hide="cookiesStatus" translate>{{ 'app.logged.dashboard.settings.cookies_unset' }}</div> <div ng-hide="cookiesStatus" translate>{{ 'app.logged.dashboard.settings.cookies_unset' }}</div>
<button ng-click="resetCookies()" ng-show="cookiesStatus" class="btn text-black btn-warning-full btn-sm m-t-xs" translate>{{ 'app.logged.dashboard.settings.reset_cookies' }}</button> <button ng-click="resetCookies()" ng-show="cookiesStatus" class="btn text-black btn-warning-full btn-sm m-t-xs" translate>{{ 'app.logged.dashboard.settings.reset_cookies' }}</button>
</div> </div>
<div class="widget-content no-bg text-center auto wrapper" ng-hide="isSuperAdmin"> <div class="widget-content no-bg text-center auto wrapper" ng-hide="isAdminSysgit add ">
<button class="btn text-white btn-danger btn-sm" ng-click="deleteUser(user)"><i class="fa fa-warning m-r-xs"></i> {{ 'app.logged.dashboard.settings.delete_my_account' | translate }}</button> <button class="btn text-white btn-danger btn-sm" ng-click="deleteUser(user)"><i class="fa fa-warning m-r-xs"></i> {{ 'app.logged.dashboard.settings.delete_my_account' | translate }}</button>
</div> </div>
</div> </div>

View File

@ -113,10 +113,10 @@ class User < ApplicationRecord
User.with_any_role(:manager, :member) User.with_any_role(:manager, :member)
end end
def self.superadmin def self.adminsys
return unless Rails.application.secrets.superadmin_email.present? return unless Rails.application.secrets.adminsys_email.present?
User.find_by(email: Rails.application.secrets.superadmin_email) User.find_by(email: Rails.application.secrets.adminsys_email)
end end
def training_machine?(machine) def training_machine?(machine)

View File

@ -40,7 +40,7 @@
Fablab.statisticsModule = ('<%= Setting.get('statistics_module') %>' === 'true'); Fablab.statisticsModule = ('<%= Setting.get('statistics_module') %>' === 'true');
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>"; Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
Fablab.trackingId = "<%= Setting.get('tracking_id') %>"; Fablab.trackingId = "<%= Setting.get('tracking_id') %>";
Fablab.superadminId = parseInt("<%= User.superadmin&.id %>", 10); Fablab.adminSysId = parseInt("<%= User.adminsys&.id %>", 10);
Fablab.baseHostUrl = "<%= Rails.application.secrets.default_host %>"; Fablab.baseHostUrl = "<%= Rails.application.secrets.default_host %>";
// i18n stuff // i18n stuff

View File

@ -13,7 +13,7 @@ class FreeDiskSpaceWorker
return if mb_available > Rails.application.secrets.disk_space_mb_alert return if mb_available > Rails.application.secrets.disk_space_mb_alert
NotificationCenter.call type: 'notify_admin_free_disk_space', NotificationCenter.call type: 'notify_admin_free_disk_space',
receiver: User.superadmin || User.admins, receiver: User.adminsys || User.admins,
attached_object: Role.first, attached_object: Role.first,
meta_data: { meta_data: {
mb_available: mb_available, mb_available: mb_available,

View File

@ -38,7 +38,7 @@ development:
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %> max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %> max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %>
disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %> disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %>
superadmin_email: <%= ENV["SUPERADMIN_EMAIL"] %> adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %> allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %> locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
@ -68,7 +68,7 @@ test:
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %> max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %> max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %>
disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %> disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %>
superadmin_email: <%= ENV["SUPERADMIN_EMAIL"] %> adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %> allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %> locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
@ -106,7 +106,7 @@ staging:
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %> max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %> max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %>
disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %> disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %>
superadmin_email: <%= ENV["SUPERADMIN_EMAIL"] %> adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
enable_in_context_translation: <%= ENV["ENABLE_IN_CONTEXT_TRANSLATION"] %> enable_in_context_translation: <%= ENV["ENABLE_IN_CONTEXT_TRANSLATION"] %>
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %> allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %> locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
@ -147,6 +147,6 @@ production:
max_cao_size: <%= ENV["MAX_CAO_SIZE"] %> max_cao_size: <%= ENV["MAX_CAO_SIZE"] %>
max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %> max_import_size: <%= ENV["MAX_IMPORT_SIZE"] %>
disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %> disk_space_mb_alert: <%= ENV["DISK_SPACE_MB_ALERT"] %>
superadmin_email: <%= ENV["SUPERADMIN_EMAIL"] %> adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %> allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %> locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>

View File

@ -111,13 +111,14 @@ The check will run every weeks and if the threshold is exceeded, an alert will b
Credentials for the first admin user created when seeding the project. Credentials for the first admin user created when seeding the project.
By default, these variables are not present in the env file, because they are only used once, when running the database seed with the command `rails db:seed`. By default, these variables are not present in the env file, because they are only used once, when running the database seed with the command `rails db:seed`.
<a name="SUPERADMIN_EMAIL"></a> <a name="ADMINSYS_EMAIL"></a>
SUPERADMIN_EMAIL ADMINSYS_EMAIL
Optional email of the administrator account in charge of the system administration. Optional email of the administrator account in charge of the system administration.
If specified, it will be hidden from the administrators list and it will exclusively receive the notifications related to the system administration. If specified, he will be hidden from the administrators list, and he will exclusively receive the notifications related to the system administration.
If not specified, every admins will receive system administration notifications. If not specified, every administrator will receive system administration notifications.
Please note that setting this parameter does not automatically create the corresponding account in Fab-manager: you must specify here the email of an existing admin account.
<a name="FORCE_VERSION_CHECK"></a> <a name="FORCE_VERSION_CHECK"></a>
FORCE_VERSION_CHECK FORCE_VERSION_CHECK

View File

@ -58,7 +58,7 @@ OPENLAB_BASE_URI=https://openprojects.fab-manager.com
# System settings # System settings
LOG_LEVEL=debug LOG_LEVEL=debug
DISK_SPACE_MB_ALERT=100 DISK_SPACE_MB_ALERT=100
SUPERADMIN_EMAIL=admin@sleede.com ADMINSYS_EMAIL=admin@sleede.com
# 5242880 = 5 megabytes # 5242880 = 5 megabytes
MAX_IMPORT_SIZE=5242880 MAX_IMPORT_SIZE=5242880

View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
config()
{
echo -ne "Checking env file... "
FABMANAGER_PATH=$(pwd)
if [ ! -w "$FABMANAGER_PATH/config/env" ]; then
echo "Fab-manager's environment file not found or not writable."
echo "Please run this script from the installation folder, and as a user having write access on config/env"
exit 1
fi
}
rename_var()
{
current=$(grep "SUPERADMIN_EMAIL=" "$FABMANAGER_PATH/config/env")
sed -i.bak "s/SUPERADMIN_EMAIL=$current/ADMINSYS_EMAIL=$current/g" "$FABMANAGER_PATH/config/env"
}
proceed()
{
config
rename_var
}
proceed "$@"

View File

@ -12,7 +12,7 @@ DEFAULT_HOST=demo.fab-manager.com
DEFAULT_PROTOCOL=https DEFAULT_PROTOCOL=https
DELIVERY_METHOD=smtp DELIVERY_METHOD=smtp
SMTP_ADDRESS=smtp.sendgrid.net SMTP_ADDRESS=smtp-relay.sendinblue.com
SMTP_PORT=587 SMTP_PORT=587
SMTP_USER_NAME= SMTP_USER_NAME=
SMTP_PASSWORD= SMTP_PASSWORD=
@ -41,8 +41,8 @@ EXCEL_DATE_FORMAT=dd/mm/yyyy
OPENLAB_BASE_URI=https://openprojects.fab-manager.com OPENLAB_BASE_URI=https://openprojects.fab-manager.com
LOG_LEVEL=debug LOG_LEVEL=debug
DISK_SPACE_MB_ALERT='100' DISK_SPACE_MB_ALERT=1024
SUPERADMIN_EMAIL= ADMINSYS_EMAIL=
ALLOW_INSECURE_HTTP=false ALLOW_INSECURE_HTTP=false
# 5242880 = 5 megabytes # 5242880 = 5 megabytes

View File

@ -296,7 +296,7 @@ configure_env_file()
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md) doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
variables=(DEFAULT_HOST DEFAULT_PROTOCOL DELIVERY_METHOD SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \ variables=(DEFAULT_HOST DEFAULT_PROTOCOL DELIVERY_METHOD SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS LOG_LEVEL MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \ SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS LOG_LEVEL MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE INTL_LOCALE INTL_CURRENCY\ ADMINSYS_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE INTL_LOCALE INTL_CURRENCY\
POSTGRESQL_LANGUAGE_ANALYZER TIME_ZONE WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT) POSTGRESQL_LANGUAGE_ANALYZER TIME_ZONE WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT)
for variable in "${variables[@]}"; do for variable in "${variables[@]}"; do
local var_doc current local var_doc current