Skip to content

Commit a9fbbc7

Browse files
committed
Introduce paid users.
1 parent 4d46fd0 commit a9fbbc7

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you are programmer/sysadmin or you just feeling that you are able to run a lo
2828
* clone this project
2929
* from the console inside the directory with source code, execute the command `mvn spring-boot:run`
3030
* open up `http://127.0.0.1:8080` in a browser
31-
* browse the site or log in as one of the pre-created users: `admin` / `test` or `coder` / `test`
31+
* browse the site or log in as one of the pre-created users: `admin`, `paid`, or `coder` with password `test`
3232
* press `Ctrl-C` to stop the server
3333

3434
**Caution!** The purpose of that version is a preview of the site and its capabilities. Because of that, the **changes** that you can make on the site **will be lost after stopping the server**!

src/main/java/ru/mystamps/web/dao/dto/UserDetails.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ public class UserDetails {
3333
private final String collectionSlug;
3434

3535
public enum Role {
36-
USER, ADMIN
36+
USER, ADMIN, PAID
3737
};
3838

3939
public boolean isAdmin() {
4040
return role == Role.ADMIN;
4141
}
4242

43+
public boolean isPaidUser() {
44+
return role == Role.PAID;
45+
}
46+
4347
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--
2+
-- Auto-generated by Maven, based on values from src/main/resources/test/spring/test-data.properties
3+
--
4+
5+
INSERT INTO users(id, login, role, name, registered_at, activated_at, hash, email) VALUES
6+
(5, 'paid', 'PAID', 'Paid User', NOW(), NOW(), '$2a$10$8Rxlvw8r7r7a.w5rxOJYY.XbBE71ivvGjlnE6w/G73A58l1I76VRK' /* test */, '[email protected]');
7+
8+
INSERT INTO collections(id, user_id, slug, updated_at, updated_by) VALUES
9+
(5, 5, 'paid', NOW(), 5);

src/main/resources/liquibase/version/0.4.xml

+1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
<include file="0.4/2018-03-11--series_remove_currency_fields.xml" relativeToChangelogFile="true" />
5252
<include file="0.4/2018-06-09--add_number_of_stamps_to_collections_series.xml" relativeToChangelogFile="true" />
5353
<include file="0.4/2018-06-15--add_price_to_collections_series.xml" relativeToChangelogFile="true" />
54+
<include file="0.4/2018-06-18--test_paid_user.xml" relativeToChangelogFile="true" />
5455

5556
</databaseChangeLog>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
7+
8+
<changeSet id="create-user-paid" author="php-coder" context="test-data">
9+
<sqlFile path="classpath:/liquibase/sql/test-user-paid.sql" relativeToChangelogFile="false" />
10+
</changeSet>
11+
12+
</databaseChangeLog>

0 commit comments

Comments
 (0)