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