Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 405830f9

Von Bernd Bleßmann vor etwa 2 Monaten hinzugefügt

  • ID 405830f95ad50433348fe1503fb3ad359834634e
  • Vorgänger 542e97f9
  • Nachfolger b36ddb3c

S:InstanceState: neues Modul zum Abfragen von nicht-konfigurations Infos

Hintergrund: Kann z.B. im Menü beim Zugriff-String verwendet werden,
um die Anzeige von Menüs an bestimmte Zustände der Instanz zu knüpfen.

Verwendung dafür folgt gleich.

Unterschiede anzeigen:

SL/InstanceState.pm
1
package SL::InstanceState;
2

  
3
use strict;
4

  
5
use SL::DB::Manager::Employee;
6

  
7
use parent qw(Rose::Object);
8

  
9

  
10
sub has_employee_project_invoices {
11
  !!@{SL::DB::Manager::Employee->current->project_invoice_permissions};
12
}
13

  
14

  
15
1;
16

  
17
__END__
18

  
19
=pod
20

  
21
=encoding utf8
22

  
23
=head1 NAME
24

  
25
SL::InstanceState - Provides instance-specific status information
26

  
27
=head1 SYNOPSIS
28

  
29
While instance configuration settings are provided via C<SL::InstanceConf>,
30
this module provides non-configuration information of the instance.
31

  
32
The intention is to use the state information in the menu, e.g. to enable
33
or disable some menu entries if some condition is met.
34

  
35
Example: If a user has no right to see invoices, the menu entry for this report
36
was shown anyway, because the user may has the right to access project invoices.
37
Now, the display of the menu entry can be made dependent on the status.
38
See C<SL::Menu>.
39

  
40
=head1 FUNCTIONS
41

  
42
=over 4
43

  
44
=item C<has_employee_project_invoices>
45

  
46
Returns trueish if the current employee has the right to access
47
some project invoices.
48

  
49
=back
50

  
51
=head1 TODO
52

  
53
As for now, no global instance of this class is provided. If this information
54
should be used in e.g. templates or some other programm code, then a global
55
instance may should be provided.
56

  
57
=head1 BUGS
58

  
59
none so far
60

  
61
=head1 AUTHOR
62

  
63
Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
64

  
65
=cut

Auch abrufbar als: Unified diff