Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
c7f3c9d9
Commit
c7f3c9d9
authored
Mar 30, 2020
by
NGPixel
Committed by
Nicolas Giard
Apr 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: user profile fetch info + groups
parent
8ea699ac
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
12 deletions
+52
-12
nav-header.vue
client/components/common/nav-header.vue
+4
-5
profile.vue
client/components/profile.vue
+8
-7
profile.vue
client/components/profile/profile.vue
+0
-0
user.js
server/graph/resolvers/user.js
+18
-0
user.graphql
server/graph/schemas/user.graphql
+18
-0
error.js
server/helpers/error.js
+4
-0
No files found.
client/components/common/nav-header.vue
View file @
c7f3c9d9
...
...
@@ -180,11 +180,10 @@
//- v-list-item-content
//- v-list-item-title
{{
$t
(
'common:header.myWiki'
)
}}
//- v-list-item-subtitle.overline Coming soon
//- v-list-item(href='/p', disabled)
//- v-list-item-action: v-icon(color='blue') mdi-face-profile
//- v-list-item-content
//- v-list-item-title
{{
$t
(
'common:header.profile'
)
}}
//- v-list-item-subtitle.overline Coming soon
v-list-item(href='/p')
v-list-item-action: v-icon(color='blue-grey') mdi-face-profile
v-list-item-content
v-list-item-title(:class='$vuetify.theme.dark ? `blue-grey--text text--lighten-3` : `blue-grey--text`')
{{
$t
(
'common:header.profile'
)
}}
v-list-item(href='/a', v-if='isAuthenticated && isAdmin')
v-list-item-action.btn-animate-rotate: v-icon(:color='$vuetify.theme.dark ? `blue-grey lighten-3` : `blue-grey`') mdi-cog
v-list-item-title(:class='$vuetify.theme.dark ? `blue-grey--text text--lighten-3` : `blue-grey--text`')
{{
$t
(
'common:header.admin'
)
}}
...
...
client/components/profile.vue
View file @
c7f3c9d9
...
...
@@ -4,14 +4,14 @@
v-navigation-drawer.pb-0(v-model='profileDrawerShown', app, fixed, clipped, left, permanent)
v-list(dense, nav)
v-list-item(to='/profile')
v-list-item-action: v-icon mdi-
account-badg
e
v-list-item-action: v-icon mdi-
face-profil
e
v-list-item-content
v-list-item-title Profile
v-list-item(to='/preferences', disabled)
v-list-item-action: v-icon(color='grey lighten-1') mdi-settings
-outline
v-list-item-content
v-list-item-title Preferences
v-list-item-subtitle.caption.grey--text.text--lighten-1 Coming soon
//-
v-list-item(to='/preferences', disabled)
//- v-list-item-action: v-icon(color='grey lighten-1') mdi-cog
-outline
//-
v-list-item-content
//-
v-list-item-title Preferences
//-
v-list-item-subtitle.caption.grey--text.text--lighten-1 Coming soon
v-list-item(to='/pages', disabled)
v-list-item-action: v-icon(color='grey lighten-1') mdi-file-document
v-list-item-content
...
...
@@ -43,7 +43,7 @@ const router = new VueRouter({
routes
:
[
{
path
:
'/'
,
redirect
:
'/profile'
},
{
path
:
'/profile'
,
component
:
()
=>
import
(
/* webpackChunkName: "profile" */
'./profile/profile.vue'
)
},
{
path
:
'/preferences'
,
component
:
()
=>
import
(
/* webpackChunkName: "profile" */
'./profile/preferences.vue'
)
},
//
{ path: '/preferences', component: () => import(/* webpackChunkName: "profile" */ './profile/preferences.vue') },
{
path
:
'/pages'
,
component
:
()
=>
import
(
/* webpackChunkName: "profile" */
'./profile/pages.vue'
)
},
{
path
:
'/comments'
,
component
:
()
=>
import
(
/* webpackChunkName: "profile" */
'./profile/comments.vue'
)
}
]
...
...
@@ -59,6 +59,7 @@ router.afterEach((to, from) => {
})
export
default
{
i18nOptions
:
{
namespaces
:
'profile'
},
data
()
{
return
{
profileDrawerShown
:
true
...
...
client/components/profile/profile.vue
View file @
c7f3c9d9
This diff is collapsed.
Click to expand it.
server/graph/resolvers/user.js
View file @
c7f3c9d9
...
...
@@ -26,6 +26,24 @@ module.exports = {
usr
.
password
=
''
usr
.
tfaSecret
=
''
return
usr
},
async
profile
(
obj
,
args
,
context
,
info
)
{
if
(
!
context
.
req
.
user
||
context
.
req
.
user
.
id
<
1
||
context
.
req
.
user
.
id
===
2
)
{
throw
new
WIKI
.
Error
.
AuthRequired
()
}
const
usr
=
await
WIKI
.
models
.
users
.
query
().
findById
(
context
.
req
.
user
.
id
)
if
(
!
usr
.
isActive
)
{
throw
new
WIKI
.
Error
.
AuthAccountBanned
()
}
const
usrGroups
=
await
usr
.
$relatedQuery
(
'groups'
)
return
{
...
usr
,
password
:
''
,
providerKey
:
''
,
tfaSecret
:
''
,
lastLoginOn
:
'1970-01-01'
,
groups
:
usrGroups
.
map
(
g
=>
g
.
name
)
}
}
},
UserMutation
:
{
...
...
server/graph/schemas/user.graphql
View file @
c7f3c9d9
...
...
@@ -27,6 +27,8 @@ type UserQuery {
single
(
id
:
Int
!
):
User
@
auth
(
requires
:
[
"
manage
:
users
"
,
"
manage
:
system
"
])
profile
:
UserProfile
}
# -----------------------------------------------
...
...
@@ -110,3 +112,19 @@ type User {
updatedAt
:
Date
!
groups
:
[
Group
]!
}
type
UserProfile
{
id
:
Int
!
name
:
String
!
email
:
String
!
providerName
:
String
isSystem
:
Boolean
!
isVerified
:
Boolean
!
location
:
String
!
jobTitle
:
String
!
timezone
:
String
!
createdAt
:
Date
!
updatedAt
:
Date
!
lastLoginOn
:
Date
!
groups
:
[
String
]!
}
server/helpers/error.js
View file @
c7f3c9d9
...
...
@@ -69,6 +69,10 @@ module.exports = {
message
:
'You are not authorized to register. Your domain is not whitelisted.'
,
code
:
1011
}),
AuthRequired
:
CustomError
(
'AuthRequired'
,
{
message
:
'You must be authenticated to access this resource.'
,
code
:
1019
}),
AuthTFAFailed
:
CustomError
(
'AuthTFAFailed'
,
{
message
:
'Incorrect TFA Security Code.'
,
code
:
1005
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment