<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!--
This file was generated by Devel::Cover Version 1.26
Devel::Cover is copyright 2001-2012, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta http-equiv="Content-Language" content="en-us"></meta>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<title>File Coverage: lib/Yukki.pm</title>
</head>
<body>
<h1>File Coverage</h1>
<table>
<tr><td class="h" align="right">File:</td><td align="left">lib/Yukki.pm</td></tr>
<tr><td class="h" align="right">Coverage:</td><td align="left" class="c2">95.2%</td></tr>
</table>
<div><br/></div>
<table>
<tr><th>line</th><th>stmt</th><th>bran</th><th>cond</th><th>sub</th><th>pod</th><th>time</th><th>code</th></tr>
<tr><td class="h">1</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">package Yukki;</td></tr>
<tr><td class="h">2</td><td colspan="7"></td></tr><tr><td class="h">3</td><td><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L3">4</a></div></td><td></td><td><div>252</div><div>13</div></td><td class="s">use v5.24;</td></tr>
<tr><td class="h">4</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L4">4</a></div></td><td></td><td><div>16</div><div>5</div><div>21</div></td><td class="s">use utf8;</td></tr>
<tr><td class="h">5</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L5">4</a></div></td><td></td><td><div>1370</div><div>15616</div><div>14</div></td><td class="s">use Moo;</td></tr>
<tr><td class="h">6</td><td colspan="7"></td></tr><tr><td class="h">7</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L7">4</a></div></td><td></td><td><div>5445</div><div>14007</div><div>97</div></td><td class="s">use Class::Load;</td></tr>
<tr><td class="h">8</td><td colspan="7"></td></tr><tr><td class="h">9</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L9">4</a></div></td><td></td><td><div>799</div><div>11</div><div>70</div></td><td class="s">use Yukki::Settings;</td></tr>
<tr><td class="h">10</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L10">4</a></div></td><td></td><td><div>999</div><div>9</div><div>15</div></td><td class="s">use Yukki::TextUtil qw( load_file );</td></tr>
<tr><td class="h">11</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L11">4</a></div></td><td></td><td><div>656</div><div>5</div><div>35</div></td><td class="s">use Yukki::Types qw( AccessLevel YukkiSettings );</td></tr>
<tr><td class="h">12</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L12">4</a></div></td><td></td><td><div>2629</div><div>9</div><div>19</div></td><td class="s">use Yukki::Error qw( http_throw );</td></tr>
<tr><td class="h">13</td><td colspan="7"></td></tr><tr><td class="h">14</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L14">4</a></div></td><td></td><td><div>3393</div><div>4929</div><div>90</div></td><td class="s">use Crypt::SaltedHash;</td></tr>
<tr><td class="h">15</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L15">4</a></div></td><td></td><td><div>18</div><div>4</div><div>158</div></td><td class="s">use List::Util qw( any );</td></tr>
<tr><td class="h">16</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L16">4</a></div></td><td></td><td><div>12</div><div>5</div><div>19</div></td><td class="s">use Type::Params qw( validate );</td></tr>
<tr><td class="h">17</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L17">4</a></div></td><td></td><td><div>731</div><div>5</div><div>16</div></td><td class="s">use Type::Utils;</td></tr>
<tr><td class="h">18</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L18">4</a></div></td><td></td><td><div>3663</div><div>6</div><div>20</div></td><td class="s">use Types::Standard qw( Dict HashRef Str Maybe slurpy Optional );</td></tr>
<tr><td class="h">19</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L19">4</a></div></td><td></td><td><div>2941</div><div>4</div><div>109</div></td><td class="s">use Path::Tiny;</td></tr>
<tr><td class="h">20</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L20">4</a></div></td><td></td><td><div>11</div><div>5</div><div>25</div></td><td class="s">use Types::Path::Tiny qw( Path );</td></tr>
<tr><td class="h">21</td><td colspan="7"></td></tr><tr><td class="h">22</td><td><div class="c3">4</div><div class="c3">4</div><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L22">4</a></div></td><td></td><td><div>951</div><div>6</div><div>19</div></td><td class="s">use namespace::clean;</td></tr>
<tr><td class="h">23</td><td colspan="7"></td></tr><tr><td class="h">24</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># ABSTRACT: Yet Uh-nother wiki</td></tr>
<tr><td class="h">25</td><td colspan="7"></td></tr><tr><td class="h">26 - 48</td><td colspan="6"></td><td class="s"><pre>=head1 DESCRIPTION
This is intended to be the simplest, stupidest wiki on the planet. It uses git for versioning and it is perfectly safe to clone this repository and push and pull and all that jazz to maintain this wiki in multiple places.
For information on getting started see L<Yukki::Manual::Installation>.
=head1 WITH ROLES
=over
=item *
L<Yukki::Role::App>
=back
=head1 ATTRIBUTES
=head2 config_file
This is the name of the configuraiton file. The application will try to find it in F<etc> within the current working directory first. If not there, it will check the C<YUKKI_CONFIG> environment variable.
=cut</pre></td></tr>
<tr><td class="h">49</td><td colspan="7"></td></tr><tr><td class="h">50</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">has config_file => (</td></tr>
<tr><td class="h">51</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> is => 'ro',</td></tr>
<tr><td class="h">52</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> isa => Path,</td></tr>
<tr><td class="h">53</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> required => 1,</td></tr>
<tr><td class="h">54</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> coerce => 1,</td></tr>
<tr><td class="h">55</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> lazy => 1,</td></tr>
<tr><td class="h">56</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> builder => '_build_config_file',</td></tr>
<tr><td class="h">57</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">);</td></tr>
<tr><td class="h">58</td><td colspan="7"></td></tr><tr><td class="h">59</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub _build_config_file {</td></tr>
<tr><td class="h">60</td><td><div class="c3">7</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L60">7</a></div></td><td></td><td><div>102</div></td><td class="s"> my $self = shift;</td></tr>
<tr><td class="h">61</td><td colspan="7"></td></tr><tr><td class="h">62</td><td><div class="c3">7</div></td><td></td><td></td><td></td><td></td><td><div>30</div></td><td class="s"> my $cwd_conf = path('.', 'etc', 'yukki.conf');</td></tr>
<tr><td class="h">63</td><td><div class="c3">7</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L63">100</a></div></td><td><div class="c3"><a href="lib-Yukki-pm--condition.html#L63">100</a></div></td><td></td><td></td><td><div>333</div></td><td class="s"> if (not $ENV{YUKKI_CONFIG} and -f "$cwd_conf") {</td></tr>
<tr><td class="h">64</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>13</div></td><td class="s"> return $cwd_conf;</td></tr>
<tr><td class="h">65</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">66</td><td colspan="7"></td></tr><tr><td class="h">67</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> die("Please make YUKKI_CONFIG point to your configuration file.\n")</td></tr>
<tr><td class="h">68</td><td><div class="c3">6</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L68">100</a></div></td><td></td><td></td><td></td><td><div>59</div></td><td class="s"> unless defined $ENV{YUKKI_CONFIG};</td></tr>
<tr><td class="h">69</td><td colspan="7"></td></tr><tr><td class="h">70</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> die("No configuration found at $ENV{YUKKI_CONFIG}. Please set YUKKI_CONFIG to the correct location.\n")</td></tr>
<tr><td class="h">71</td><td><div class="c3">5</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L71">100</a></div></td><td></td><td></td><td></td><td><div>157</div></td><td class="s"> unless -f $ENV{YUKKI_CONFIG};</td></tr>
<tr><td class="h">72</td><td colspan="7"></td></tr><tr><td class="h">73</td><td><div class="c3">4</div></td><td></td><td></td><td></td><td></td><td><div>38</div></td><td class="s"> return $ENV{YUKKI_CONFIG};</td></tr>
<tr><td class="h">74</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">75</td><td colspan="7"></td></tr><tr><td class="h">76 - 80</td><td colspan="6"></td><td class="s"><pre>=head2 settings
This is the configuration loaded from the L</config_file>.
=cut</pre></td></tr>
<tr><td class="h">81</td><td colspan="7"></td></tr><tr><td class="h">82</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">has settings => (</td></tr>
<tr><td class="h">83</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> is => 'ro',</td></tr>
<tr><td class="h">84</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> isa => YukkiSettings,</td></tr>
<tr><td class="h">85</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> required => 1,</td></tr>
<tr><td class="h">86</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> coerce => 1,</td></tr>
<tr><td class="h">87</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> lazy => 1,</td></tr>
<tr><td class="h">88</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> builder => '_build_settings',</td></tr>
<tr><td class="h">89</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">);</td></tr>
<tr><td class="h">90</td><td colspan="7"></td></tr><tr><td class="h">91</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub _build_settings {</td></tr>
<tr><td class="h">92</td><td><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L92">4</a></div></td><td></td><td><div>86</div></td><td class="s"> my $self = shift;</td></tr>
<tr><td class="h">93</td><td><div class="c3">4</div></td><td></td><td></td><td></td><td></td><td><div>74</div></td><td class="s"> load_file($self->config_file)</td></tr>
<tr><td class="h">94</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">95</td><td colspan="7"></td></tr><tr><td class="h">96 - 104</td><td colspan="6"></td><td class="s"><pre>=head1 METHODS
=head2 view
my $view = $app->view('Page');
Not implemented in this class. See L<Yukki::Web>.
=cut</pre></td></tr>
<tr><td class="h">105</td><td colspan="7"></td></tr><tr><td class="h">106</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L106">1</a></div></td><td><div class="c3">1</div></td><td><div>6</div></td><td class="s">sub view { ... }</td></tr>
<tr><td class="h">107</td><td colspan="7"></td></tr><tr><td class="h">108 - 114</td><td colspan="6"></td><td class="s"><pre>=head2 controller
my $controller = $app->controller('Page');
Not implemented in this class. See L<Yukki::Web>.
=cut</pre></td></tr>
<tr><td class="h">115</td><td colspan="7"></td></tr><tr><td class="h">116</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L116">1</a></div></td><td><div class="c3">1</div></td><td><div>5</div></td><td class="s">sub controller { ... }</td></tr>
<tr><td class="h">117</td><td colspan="7"></td></tr><tr><td class="h">118 - 125</td><td colspan="6"></td><td class="s"><pre>=head2 model
my $model = $app->model('Repository', { repository => 'main' });
Returns an instance of the requested model class. The parameters are passed to
the instance constructor.
=cut</pre></td></tr>
<tr><td class="h">126</td><td colspan="7"></td></tr><tr><td class="h">127</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub model {</td></tr>
<tr><td class="h">128</td><td><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L128">4</a></div></td><td><div class="c3">1</div></td><td><div>52</div></td><td class="s"> my ($self, $name, $params) = @_;</td></tr>
<tr><td class="h">129</td><td><div class="c3">4</div></td><td></td><td></td><td></td><td></td><td><div>13</div></td><td class="s"> my $class_name = join '::', 'Yukki::Model', $name;</td></tr>
<tr><td class="h">130</td><td><div class="c3">4</div></td><td></td><td></td><td></td><td></td><td><div>21</div></td><td class="s"> Class::Load::load_class($class_name);</td></tr>
<tr><td class="h">131</td><td><div class="c3">4</div><div class="c3">4</div></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--condition.html#L131">100</a></div></td><td></td><td></td><td><div>115</div><div>36</div></td><td class="s"> return $class_name->new(app => $self, %{ $params // {} });</td></tr>
<tr><td class="h">132</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">133</td><td colspan="7"></td></tr><tr><td class="h">134 - 143</td><td colspan="6"></td><td class="s"><pre>=head2 locate
my $file = $app->locate('user_path', 'test_user');
The first argument is the name of the configuration directive naming the path.
It may be followed by one or more path components to be tacked on to the end.
Returns a L<Path::Tiny> for the file.
=cut</pre></td></tr>
<tr><td class="h">144</td><td colspan="7"></td></tr><tr><td class="h">145</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub _locate {</td></tr>
<tr><td class="h">146</td><td><div class="c3">14</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L146">14</a></div></td><td></td><td><div>35</div></td><td class="s"> my ($self, $type, $base, @extra_path) = @_;</td></tr>
<tr><td class="h">147</td><td colspan="7"></td></tr><tr><td class="h">148</td><td><div class="c3">14</div></td><td></td><td></td><td></td><td></td><td><div>256</div></td><td class="s"> my $base_path = $self->settings->$base;</td></tr>
<tr><td class="h">149</td><td><div class="c3">14</div></td><td></td><td></td><td></td><td></td><td><div>898</div></td><td class="s"> my $root_path;</td></tr>
<tr><td class="h">150</td><td colspan="7"></td></tr><tr><td class="h">151</td><td><div class="c3">14</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L151">100</a></div></td><td></td><td></td><td></td><td><div>52</div></td><td class="s"> if ($base_path !~ m{^/}) {</td></tr>
<tr><td class="h">152</td><td><div class="c3">12</div></td><td></td><td></td><td></td><td></td><td><div>182</div></td><td class="s"> $root_path = path($self->settings->root, $base_path);</td></tr>
<tr><td class="h">153</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">154</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> else {</td></tr>
<tr><td class="h">155</td><td><div class="c3">2</div></td><td></td><td></td><td></td><td></td><td><div>12</div></td><td class="s"> $root_path = path($base_path);</td></tr>
<tr><td class="h">156</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">157</td><td colspan="7"></td></tr><tr><td class="h">158</td><td><div class="c3">14</div></td><td></td><td></td><td></td><td></td><td><div>553</div></td><td class="s"> my $located_path = $root_path->child(@extra_path);</td></tr>
<tr><td class="h">159</td><td colspan="7"></td></tr><tr><td class="h">160</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # Small safety mechanism</td></tr>
<tr><td class="h">161</td><td><div class="c3">14</div></td><td><div class="c0" title="-/F"><a href="lib-Yukki-pm--branch.html#L161">50</a></div></td><td></td><td></td><td></td><td><div>430</div></td><td class="s"> die "attempted to lookup an illegal $base path: ", join('/', @extra_path)</td></tr>
<tr><td class="h">162</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> unless $root_path->subsumes($located_path);</td></tr>
<tr><td class="h">163</td><td colspan="7"></td></tr><tr><td class="h">164</td><td><div class="c3">14</div></td><td></td><td></td><td></td><td></td><td><div>1299</div></td><td class="s"> return $located_path;</td></tr>
<tr><td class="h">165</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">166</td><td colspan="7"></td></tr><tr><td class="h">167</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub locate {</td></tr>
<tr><td class="h">168</td><td><div class="c3">2</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L168">2</a></div></td><td><div class="c3">1</div></td><td><div>29</div></td><td class="s"> my ($self, $base, @extra_path) = @_;</td></tr>
<tr><td class="h">169</td><td><div class="c3">2</div></td><td></td><td></td><td></td><td></td><td><div>6</div></td><td class="s"> $self->_locate(file => $base, @extra_path);</td></tr>
<tr><td class="h">170</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">171</td><td colspan="7"></td></tr><tr><td class="h">172 - 179</td><td colspan="6"></td><td class="s"><pre>=head2 locate_dir
my $dir = $app->locate_dir('repository_path', 'main.git');
The arguments are identical to L</locate>, but returns a L<Path::Tiny> for
the given file.
=cut</pre></td></tr>
<tr><td class="h">180</td><td colspan="7"></td></tr><tr><td class="h">181</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub locate_dir {</td></tr>
<tr><td class="h">182</td><td><div class="c3">12</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L182">12</a></div></td><td><div class="c3">1</div></td><td><div>84</div></td><td class="s"> my ($self, $base, @extra_path) = @_;</td></tr>
<tr><td class="h">183</td><td><div class="c3">12</div></td><td></td><td></td><td></td><td></td><td><div>38</div></td><td class="s"> $self->_locate(dir => $base, @extra_path);</td></tr>
<tr><td class="h">184</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">185</td><td colspan="7"></td></tr><tr><td class="h">186 - 201</td><td colspan="6"></td><td class="s"><pre>=head2 check_access
my $access_is_ok = $app->check_access({
user => $user,
repository => 'main',
needs => 'read',
});
The C<user> is optional. It should be an object returned from
L<Yukki::Model::User>. The C<repository> is required and should be the name of
the repository the user is trying to gain access to. The C<needs> is the access
level the user needs. It must be an L<Yukki::Types/AccessLevel>.
The method returns a true value if access should be granted or false otherwise.
=cut</pre></td></tr>
<tr><td class="h">202</td><td colspan="7"></td></tr><tr><td class="h">203</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub check_access {</td></tr>
<tr><td class="h">204</td><td><div class="c3">60</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L204">60</a></div></td><td><div class="c3">1</div></td><td><div>1572</div></td><td class="s"> my ($self, $opt)</td></tr>
<tr><td class="h">205</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> = validate(\@_, class_type(__PACKAGE__),</td></tr>
<tr><td class="h">206</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> slurpy Dict[</td></tr>
<tr><td class="h">207</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> user => Maybe[class_type('Yukki::User')],</td></tr>
<tr><td class="h">208</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> special => Optional[Str],</td></tr>
<tr><td class="h">209</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => Optional[Str],</td></tr>
<tr><td class="h">210</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> needs => AccessLevel,</td></tr>
<tr><td class="h">211</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> ]</td></tr>
<tr><td class="h">212</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">213</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my ($user, $repository, $special, $needs)</td></tr>
<tr><td class="h">214</td><td><div class="c3">60</div><div class="c3">60</div></td><td></td><td></td><td></td><td></td><td><div>494268</div><div>12181</div></td><td class="s"> = @{$opt}{qw( user repository special needs )};</td></tr>
<tr><td class="h">215</td><td colspan="7"></td></tr><tr><td class="h">216</td><td><div class="c3">60</div></td><td></td><td><div class="c0"><a href="lib-Yukki-pm--condition.html#L216">50</a></div></td><td></td><td></td><td><div>132</div></td><td class="s"> $repository //= '-';</td></tr>
<tr><td class="h">217</td><td><div class="c3">60</div></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--condition.html#L217">100</a></div></td><td></td><td></td><td><div>168</div></td><td class="s"> $special //= '-';</td></tr>
<tr><td class="h">218</td><td colspan="7"></td></tr><tr><td class="h">219</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # Always grant none</td></tr>
<tr><td class="h">220</td><td><div class="c3">60</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L220">100</a></div></td><td></td><td></td><td></td><td><div>171</div></td><td class="s"> return 1 if $needs eq 'none';</td></tr>
<tr><td class="h">221</td><td colspan="7"></td></tr><tr><td class="h">222</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my $config = $self->settings->repositories->{$repository}</td></tr>
<tr><td class="h">223</td><td><div class="c3">43</div></td><td></td><td><div class="c0"><a href="lib-Yukki-pm--condition.html#L223">33</a></div></td><td></td><td></td><td><div>908</div></td><td class="s"> // $self->settings->special_privileges->{$special};</td></tr>
<tr><td class="h">224</td><td colspan="7"></td></tr><tr><td class="h">225</td><td><div class="c3">43</div></td><td><div class="c0" title="-/F"><a href="lib-Yukki-pm--branch.html#L225">50</a></div></td><td></td><td></td><td></td><td><div>378</div></td><td class="s"> return '' unless $config;</td></tr>
<tr><td class="h">226</td><td colspan="7"></td></tr><tr><td class="h">227</td><td><div class="c3">43</div></td><td></td><td></td><td></td><td></td><td><div>115</div></td><td class="s"> my $read_groups = $config->read_groups;</td></tr>
<tr><td class="h">228</td><td><div class="c3">43</div></td><td></td><td></td><td></td><td></td><td><div>78</div></td><td class="s"> my $write_groups = $config->write_groups;</td></tr>
<tr><td class="h">229</td><td colspan="7"></td></tr><tr><td class="h">230</td><td><div class="c3">43</div></td><td></td><td></td><td></td><td></td><td><div>109</div></td><td class="s"> my %access_level = (none => 0, read => 1, write => 2);</td></tr>
<tr><td class="h">231</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my $has_access = sub {</td></tr>
<tr><td class="h">232</td><td><div class="c3">63</div></td><td></td><td><div class="c0"><a href="lib-Yukki-pm--condition.html#L232">50</a></div></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L232">63</a></div></td><td></td><td><div>302</div></td><td class="s"> $access_level{$_[0] // 'none'} >= $access_level{$needs}</td></tr>
<tr><td class="h">233</td><td><div class="c3">43</div></td><td></td><td></td><td></td><td></td><td><div>105</div></td><td class="s"> };</td></tr>
<tr><td class="h">234</td><td colspan="7"></td></tr><tr><td class="h">235</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # Deal with anonymous users first.</td></tr>
<tr><td class="h">236</td><td><div class="c3">43</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L236">100</a></div></td><td></td><td></td><td></td><td><div>100</div></td><td class="s"> return 1 if $has_access->($config->anonymous_access_level);</td></tr>
<tr><td class="h">237</td><td><div class="c3">28</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L237">100</a></div></td><td></td><td></td><td></td><td><div>151</div></td><td class="s"> return '' unless $user;</td></tr>
<tr><td class="h">238</td><td colspan="7"></td></tr><tr><td class="h">239</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> # Only logged users considered here forward.</td></tr>
<tr><td class="h">240</td><td><div class="c3">11</div><div class="c3">11</div></td><td></td><td><div class="c0"><a href="lib-Yukki-pm--condition.html#L240">50</a></div></td><td></td><td></td><td><div>14</div><div>31</div></td><td class="s"> my @user_groups = @{ $user->{groups} // [] };</td></tr>
<tr><td class="h">241</td><td colspan="7"></td></tr><tr><td class="h">242</td><td><div class="c3">11</div></td><td></td><td></td><td></td><td></td><td><div>20</div></td><td class="s"> for my $level (qw( read write )) {</td></tr>
<tr><td class="h">243</td><td><div class="c3">20</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L243">100</a></div></td><td></td><td></td><td></td><td><div>27</div></td><td class="s"> if ($has_access->($level)) {</td></tr>
<tr><td class="h">244</td><td colspan="7"></td></tr><tr><td class="h">245</td><td><div class="c3">14</div></td><td></td><td></td><td></td><td></td><td><div>22</div></td><td class="s"> my $groups = "${level}_groups";</td></tr>
<tr><td class="h">246</td><td colspan="7"></td></tr><tr><td class="h">247</td><td><div class="c3">14</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L247">100</a></div></td><td></td><td></td><td></td><td><div>52</div></td><td class="s"> return 1 if $config->$groups eq 'ANY';</td></tr>
<tr><td class="h">248</td><td colspan="7"></td></tr><tr><td class="h">249</td><td><div class="c3">11</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L249">100</a></div><div class="c0" title="-/F"><a href="lib-Yukki-pm--branch.html#L249">50</a></div></td><td></td><td></td><td></td><td><div>34</div></td><td class="s"> if (ref $config->$groups eq 'ARRAY') {</td></tr>
<tr><td class="h">250</td><td><div class="c3">5</div><div class="c3">5</div></td><td></td><td></td><td></td><td></td><td><div>7</div><div>12</div></td><td class="s"> my @level_groups = @{ $config->$groups };</td></tr>
<tr><td class="h">251</td><td colspan="7"></td></tr><tr><td class="h">252</td><td><div class="c3">5</div></td><td></td><td></td><td></td><td></td><td><div>8</div></td><td class="s"> for my $level_group (@level_groups) {</td></tr>
<tr><td class="h">253</td><td><div class="c3">9</div><div class="c3">9</div></td><td><div class="c3" title="T/F"><a href="lib-Yukki-pm--branch.html#L253">100</a></div></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L253">9</a></div></td><td></td><td><div>20</div><div>45</div></td><td class="s"> return 1 if any { $_ eq $level_group } @user_groups;</td></tr>
<tr><td class="h">254</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">255</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">256</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> elsif ($config->$groups ne 'NONE') {</td></tr>
<tr><td class="h">257</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> warn "weird value ", $config->$groups,</td></tr>
<tr><td class="h">258</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> " in $groups config for $repository settings";</td></tr>
<tr><td class="h">259</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">260</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">261</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">262</td><td colspan="7"></td></tr><tr><td class="h">263</td><td><div class="c3">5</div></td><td></td><td></td><td></td><td></td><td><div>31</div></td><td class="s"> return '';</td></tr>
<tr><td class="h">264</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">265</td><td colspan="7"></td></tr><tr><td class="h">266 - 270</td><td colspan="6"></td><td class="s"><pre>=head2 hasher
Returns a message digest object that can be used to create a cryptographic hash.
=cut</pre></td></tr>
<tr><td class="h">271</td><td colspan="7"></td></tr><tr><td class="h">272</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub hasher {</td></tr>
<tr><td class="h">273</td><td><div class="c3">4</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-pm--subroutine.html#L273">4</a></div></td><td><div class="c3">1</div></td><td><div>6</div></td><td class="s"> my $self = shift;</td></tr>
<tr><td class="h">274</td><td colspan="7"></td></tr><tr><td class="h">275</td><td><div class="c3">4</div></td><td></td><td></td><td></td><td></td><td><div>72</div></td><td class="s"> return Crypt::SaltedHash->new(algorithm => $self->settings->digest);</td></tr>
<tr><td class="h">276</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">277</td><td colspan="7"></td></tr><tr><td class="h">278</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">with qw( Yukki::Role::App );</td></tr>
<tr><td class="h">279</td><td colspan="7"></td></tr><tr><td class="h">280 - 286</td><td colspan="6"></td><td class="s"><pre>=head1 WHY?
I wanted a Perl-based, MultiMarkdown-supporting wiki that I could take sermon notes and personal study notes for church and Bible study and such. However, I'm offline at church, so I want to do this from my laptop and sync it up to the master wiki when I get home. That's it.
Does it suit your needs? I don't really care, but if I've shared this on the CPAN or the GitHub, then I'm offering it to you in case you might find it useful WITHOUT WARRANTY. If you want it to suit your needs, bug me by email at C<< hanenkamp@cpan.org >> and send me patches.
=cut</pre></td></tr>
<tr><td class="h">287</td><td colspan="7"></td></tr><tr><td class="h">288</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">1;</td></tr>
</table>
</body>
</html>