line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
598
|
use 5.006; |
|
1
|
|
|
|
|
1
|
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Metabase::User::Profile; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.025'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
2
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
10
|
1
|
|
|
1
|
|
385
|
use Data::GUID guid_string => { -as => '_guid' }; |
|
1
|
|
|
|
|
10313
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
537
|
use Metabase::Report; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
159
|
|
13
|
|
|
|
|
|
|
our @ISA = qw/Metabase::Report/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__PACKAGE__->load_fact_classes; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
18
|
|
|
|
|
|
|
# public API |
19
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub create { |
22
|
1
|
|
|
1
|
1
|
227
|
my ( $class, @args ) = @_; |
23
|
1
|
|
|
|
|
8
|
my $args = $class->__validate_args( |
24
|
|
|
|
|
|
|
\@args, |
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
full_name => 1, |
27
|
|
|
|
|
|
|
email_address => 1, |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# resource string must reference our own guid, so pregenerate it |
32
|
1
|
|
|
|
|
23
|
my $guid = lc _guid(); |
33
|
1
|
|
|
|
|
878
|
my $profile = $class->open( |
34
|
|
|
|
|
|
|
guid => $guid, |
35
|
|
|
|
|
|
|
resource => "metabase:user:$guid", |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# we are our own creator |
39
|
1
|
|
|
|
|
5
|
$profile->set_creator( $profile->resource ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# add facts |
42
|
1
|
|
|
|
|
5
|
$profile->add( 'Metabase::User::FullName' => $args->{full_name} ); |
43
|
1
|
|
|
|
|
3
|
$profile->add( 'Metabase::User::EmailAddress' => $args->{email_address} ); |
44
|
1
|
|
|
|
|
4
|
$profile->close; |
45
|
1
|
|
|
|
|
4
|
return $profile; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
49
|
|
|
|
|
|
|
# internals |
50
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub validate_resource { |
53
|
3
|
|
|
3
|
1
|
4
|
my ($self) = shift; |
54
|
3
|
|
|
|
|
9
|
my $resource = $self->SUPER::validate_resource(@_); |
55
|
3
|
|
|
|
|
5
|
my ($guid) = $resource->guid; |
56
|
3
|
50
|
|
|
|
10
|
Carp::confess "resource guid differs from fact guid" if $guid ne $self->guid; |
57
|
3
|
|
|
|
|
7
|
return $resource; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub report_spec { |
61
|
|
|
|
|
|
|
return { |
62
|
2
|
|
|
2
|
1
|
13
|
'Metabase::User::FullName' => '1', |
63
|
|
|
|
|
|
|
'Metabase::User::EmailAddress' => '1+', |
64
|
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# ABSTRACT: Metabase report class for user-related facts |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |