Skip to content

Commit

Permalink
Organization attribute in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
uralm1 committed Jan 28, 2022
1 parent 3637d5f commit 9032c37
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.

## [Unreleased]
- Значение аттрибута организация сделано настраиваемым через конфигурационный файл.
- Исправлен баг из-за которого наименования подразделений с разным количеством пробелов считались одинаковыми в процедуре расчета перемещения пользователей.

## [1.20] - 2022-01-27
- Исправлен поиск "0".
Expand Down
2 changes: 2 additions & 0 deletions adup.conf_empty
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
log_lines_on_page => 12,
changes_on_page => 10,

organization_attr => 'MY FIRM',

smb_share => '//smbserver/dbf',
smb_file => 'persons.dbf',
smb_user => 'user',
Expand Down
4 changes: 2 additions & 2 deletions lib/Adup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Adup::Command::smbload;
use Adup::Command::zupload;
use Adup::Command::cron;

our $VERSION = '1.20';
our $VERSION = '1.21';

# This method will run once at server start
sub startup {
Expand Down Expand Up @@ -135,7 +135,7 @@ sub validate_config {
my $c = $self->config;

my $e = undef;
for (qw/personnel_ldap_base flatgroups_ldap_base dismissed_ou_dn/) {
for (qw/personnel_ldap_base flatgroups_ldap_base dismissed_ou_dn organization_attr/) {
unless ($c->{$_}) {
$e = "Config parameter $_ is not defined!";
last;
Expand Down
3 changes: 2 additions & 1 deletion lib/Adup/Ural/SyncAttributesCreateMoveUsers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ sub do_sync {
my $ldapbase = $args{job}->app->config->{ldap_base};
my $pers_ldapbase = $args{job}->app->config->{personnel_ldap_base};
my $fg_ldapbase = $args{job}->app->config->{flatgroups_ldap_base};
my $organization_attr = $args{job}->app->config->{organization_attr};
my @attributes = qw/givenName sn middleName displayName initials title company department description employeeID/;

while (my $next = $res->hash) {
Expand All @@ -76,7 +77,7 @@ sub do_sync {
$refhash->{displayName} = substr($next->{fio}, 0, 256);
$refhash->{initials} = _abbr($next->{fio});
$refhash->{title} = substr($next->{dolj}, 0, 128) if $next->{dolj};
$refhash->{company} = 'МУП "Уфаводоканал"';
$refhash->{company} = $organization_attr;
$refhash->{department} = substr($next->{dept}, 0, 64) if $next->{dept};
$refhash->{description} = substr($next->{otdel}, 0, 1024) if $next->{otdel};
$refhash->{employeeID} = substr($next->{tabn}, 0, 16) if $next->{tabn};
Expand Down

0 comments on commit 9032c37

Please sign in to comment.