This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
582 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
enum Role { | ||
USER = 1, | ||
ADMIN = 2, | ||
CONTRIBUTOR = 3 | ||
CONTRIBUTOR_LVL_1 = 3, // can only create, edit, delete posts they create | ||
CONTRIBUTOR_LVL_2 = 4, // can also create series & taxonomies & sync taxonomy lessons | ||
} | ||
|
||
export const RoleWeights = [Role.USER, Role.CONTRIBUTOR_LVL_1, Role.CONTRIBUTOR_LVL_2, Role.ADMIN] | ||
|
||
export default Role; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import RoleEnum, { RoleWeights} from 'App/Enums/Roles' | ||
import Role from 'App/Models/Role' | ||
import Event from '@ioc:Adonis/Core/Event' | ||
|
||
export default class UserService { | ||
public static async sendRoleUpdateNotification(user: User, newRole: Role, oldRole: Role) { | ||
const oldRoleWeight = RoleWeights.findIndex(id => id === oldRole.id) | ||
const newRoleWeight = RoleWeights.findIndex(id => id === newRole.id) | ||
console.log({ oldRoleWeight, newRoleWeight }) | ||
if (oldRoleWeight >= newRoleWeight) return | ||
|
||
switch (newRole.id) { | ||
case RoleEnum.CONTRIBUTOR_LVL_1: | ||
return Event.emit('role:upgrade:contributor_lvl_1', { user, newRole, oldRole }) | ||
case RoleEnum.CONTRIBUTOR_LVL_2: | ||
return Event.emit('role:upgrade:contributor_lvl_2', { user, newRole, oldRole }) | ||
case RoleEnum.ADMIN: | ||
return Event.emit('role:upgrade:admin', { user, newRole, oldRole }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"assets/app.css": "http://localhost:58020/assets/app.css", | ||
"assets/app.js": "http://localhost:58020/assets/app.js", | ||
"assets/post.js": "http://localhost:58020/assets/post.js", | ||
"assets/stream.js": "http://localhost:58020/assets/stream.js", | ||
"assets/file_manager.js": "http://localhost:58020/assets/file_manager.js", | ||
"assets/tiptap_basic.js": "http://localhost:58020/assets/tiptap_basic.js", | ||
"assets/studio.posts.editor.js": "http://localhost:58020/assets/studio.posts.editor.js", | ||
"assets/studio.collections.js": "http://localhost:58020/assets/studio.collections.js" | ||
"assets/app.css": "http://localhost:63705/assets/app.css", | ||
"assets/app.js": "http://localhost:63705/assets/app.js", | ||
"assets/post.js": "http://localhost:63705/assets/post.js", | ||
"assets/stream.js": "http://localhost:63705/assets/stream.js", | ||
"assets/file_manager.js": "http://localhost:63705/assets/file_manager.js", | ||
"assets/tiptap_basic.js": "http://localhost:63705/assets/tiptap_basic.js", | ||
"assets/studio.posts.editor.js": "http://localhost:63705/assets/studio.posts.editor.js", | ||
"assets/studio.collections.js": "http://localhost:63705/assets/studio.collections.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<p | ||
style=" | ||
color: #000000; | ||
font-size: 16px; | ||
mso-line-height-rule: exactly; | ||
line-height: 24px; | ||
font-family: Arial, sans-serif; | ||
" | ||
> | ||
<a | ||
href="{{ href }}" | ||
style=" | ||
font-size: 16px; | ||
mso-line-height-rule: exactly; | ||
line-height: 24px; | ||
font-family: Arial, sans-serif; | ||
text-decoration: underline; | ||
font-weight: bold; | ||
color: #0000ff; | ||
" | ||
> | ||
{{{ await $slots.main() }}} | ||
</a | ||
> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<p | ||
style=" | ||
color: #000000; | ||
font-size: 16px; | ||
mso-line-height-rule: exactly; | ||
line-height: 24px; | ||
font-family: Arial, sans-serif; | ||
{{ style }} | ||
" | ||
> | ||
{{{ await $slots.main() }}} | ||
</p> |
Oops, something went wrong.