| 1 | package Yukki::User; | ||
| 2 | 4 | $Yukki::User::VERSION = '0.991_002'; # TRIAL | |
| 3 | |||
| 4 | 4 | ▶ | $Yukki::User::VERSION = '0.991002';use v5.24; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 4 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 4 | with 'Yukki::Role::Savable'; | |
| 9 | |||
| 10 | 4 | ▶ | use Types::Standard qw( Str ArrayRef ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 4 | ▶ | use Yukki::Types qw( LoginName ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 4 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | # ABSTRACT: Encapsulates Yukki users | ||
| 16 | |||
| 17 | |||
| 18 | 4 | has login_name => ( | |
| 19 | is => 'ro', | ||
| 20 | isa => LoginName, | ||
| 21 | required => 1, | ||
| 22 | ); | ||
| 23 | |||
| 24 | |||
| 25 | 4 | has password => ( | |
| 26 | is => 'rw', | ||
| 27 | isa => Str, | ||
| 28 | required => 1, | ||
| 29 | ); | ||
| 30 | |||
| 31 | |||
| 32 | 4 | has name => ( | |
| 33 | is => 'rw', | ||
| 34 | isa => Str, | ||
| 35 | required => 1, | ||
| 36 | ); | ||
| 37 | |||
| 38 | |||
| 39 | 4 | has email => ( | |
| 40 | is => 'rw', | ||
| 41 | isa => Str, | ||
| 42 | required => 1, | ||
| 43 | ); | ||
| 44 | |||
| 45 | |||
| 46 | has groups => ( | ||
| 47 | is => 'ro', | ||
| 48 | isa => ArrayRef[Str], | ||
| 49 | required => 1, | ||
| 50 | lazy => 1, | ||
| 51 | 0 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 52 | 4 | ); | |
| 53 | |||
| 54 | |||
| 55 | 0 | ▶ | sub groups_string { join ' ', shift->groups->@* } |
|
Subroutine
groups_string: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 56 | |||
| 57 | |||
| 58 | sub savable_attributes { | ||
| 59 | 3 | ▶ | qw( |
|
Subroutine
savable_attributes: called CC=1 SCAR=0.0
Pod
documented
| |||
| 60 | login_name | ||
| 61 | password | ||
| 62 | name | ||
| 63 | |||
| 64 | groups | ||
| 65 | ) | ||
| 66 | } | ||
| 67 | |||
| 68 | 4 | 1; | |
| 69 | |||
| 70 | __END__ | ||
| 71 | |||
| 72 | =pod | ||
| 73 | |||
| 74 | =encoding UTF-8 | ||
| 75 | |||
| 76 | =head1 NAME | ||
| 77 | |||
| 78 | Yukki::User - Encapsulates Yukki users | ||
| 79 | |||
| 80 | =head1 VERSION | ||
| 81 | |||
| 82 | version 0.991_002 | ||
| 83 | |||
| 84 | =head1 SYNOPSIS | ||
| 85 | |||
| 86 | use Yukki::User; | ||
| 87 | |||
| 88 | my $user_file = $app->locate('user_path', 'bob'); | ||
| 89 | my $user = Yukki::User->load_yaml($user_file); | ||
| 90 | |||
| 91 | say "login name: ", $user->login_name; | ||
| 92 | say "password: ", $user->password; | ||
| 93 | say "name: ", $user->name; | ||
| 94 | say "email: ", $user->email; | ||
| 95 | say "groups: ", join(', ', $user->groups->@*); | ||
| 96 | |||
| 97 | =head1 DESCRIPTION | ||
| 98 | |||
| 99 | Encapsulates the definition of a user object. Users are defined to provide information about the author of each change in the wiki. | ||
| 100 | |||
| 101 | =head1 ROLES | ||
| 102 | |||
| 103 | L<Yukki::Role::Savable> | ||
| 104 | |||
| 105 | =head1 ATTRIBUTES | ||
| 106 | |||
| 107 | =head2 login_name | ||
| 108 | |||
| 109 | This is the name the user uses to login. | ||
| 110 | |||
| 111 | =head2 password | ||
| 112 | |||
| 113 | This is the hashed password for the user. | ||
| 114 | |||
| 115 | =head2 name | ||
| 116 | |||
| 117 | This is the full name of the user, used as the author name on commits. | ||
| 118 | |||
| 119 | =head2 email | ||
| 120 | |||
| 121 | This is the email address of the user, used to uniquely identify the author in commits. | ||
| 122 | |||
| 123 | =head2 groups | ||
| 124 | |||
| 125 | This is the list of groups to which the user belongs. | ||
| 126 | |||
| 127 | =head1 METHODS | ||
| 128 | |||
| 129 | =head2 groups_string | ||
| 130 | |||
| 131 | Returns the groups concatenated together into a single string. | ||
| 132 | |||
| 133 | =head2 savable_attributes | ||
| 134 | |||
| 135 | Returns the savable attributes. | ||
| 136 | |||
| 137 | =head1 AUTHOR | ||
| 138 | |||
| 139 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||
| 140 | |||
| 141 | =head1 COPYRIGHT AND LICENSE | ||
| 142 | |||
| 143 | This software is copyright (c) 2017 by Qubling Software LLC. | ||
| 144 | |||
| 145 | This is free software; you can redistribute it and/or modify it under | ||
| 146 | the same terms as the Perl 5 programming language system itself. | ||
| 147 | |||
| 148 | =cut | ||