summaryrefslogtreecommitdiffstats
path: root/lib/ASM
diff options
context:
space:
mode:
authorLibravatarJanik Kleinhoff <ilbelkyr@shalture.org>2016-10-30 13:00:32 +0000
committerLibravatarJanik Kleinhoff <ilbelkyr@shalture.org>2016-10-30 13:47:22 +0000
commit3012c7711d956750b4444280ce31aaa8570e7cce (patch)
treec94587a3f642fe95a4c73b91357697dbbdabd64a /lib/ASM
parentde9f3deabe35fcc0a09dd4c62b6c626ba4282447 (diff)
DB: add "users" table for webusers
For now, mere presence in the table means a given user is authorized to view stuff. We can make this more granular later on (important for T11).
Diffstat (limited to 'lib/ASM')
-rw-r--r--lib/ASM/DB.pm2
-rw-r--r--lib/ASM/DB/Result/User.pm38
2 files changed, 39 insertions, 1 deletions
diff --git a/lib/ASM/DB.pm b/lib/ASM/DB.pm
index 768e6cb..84f323b 100644
--- a/lib/ASM/DB.pm
+++ b/lib/ASM/DB.pm
@@ -1,5 +1,5 @@
use utf8;
-package ASM::DB 1;
+package ASM::DB 2;
use strict;
use warnings;
diff --git a/lib/ASM/DB/Result/User.pm b/lib/ASM/DB/Result/User.pm
new file mode 100644
index 0000000..1a35c3a
--- /dev/null
+++ b/lib/ASM/DB/Result/User.pm
@@ -0,0 +1,38 @@
+use utf8;
+package ASM::DB::Result::User;
+
+use strict;
+use warnings;
+
+use parent 'DBIx::Class::Core';
+
+__PACKAGE__->load_components('InflateColumn::DateTime', 'PassphraseColumn');
+__PACKAGE__->table('users');
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'bigint',
+ is_auto_increment => 1,
+ is_nullable => 0
+ },
+ name => {
+ data_type => 'varchar',
+ size => 20,
+ is_nullable => 0,
+ },
+ passphrase => {
+ data_type => 'text',
+ passphrase => 'rfc2307',
+ passphrase_class => 'BlowfishCrypt',
+ passphrase_args => {
+ cost => 13,
+ salt_random => 1,
+ },
+ passphrase_check_method => 'check_passphrase',
+ is_nullable => 0,
+ },
+);
+
+__PACKAGE__->set_primary_key('id');
+__PACKAGE__->add_unique_constraint(uniq_user_name => ['name']);
+
+1;