mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-02 07:27:01 +00:00
Merge branch 'fix_rbac' of github.com:jumpserver/lina into fix_rbac
This commit is contained in:
commit
1824519d6c
@ -93,13 +93,19 @@ export default {
|
||||
}
|
||||
.el-menu--horizontal .el-menu .el-menu-item {
|
||||
display: inline-block!important;
|
||||
padding: 10px 10px;
|
||||
text-align: center;
|
||||
padding: 6px 0px 6px 18px;
|
||||
height: 70px;
|
||||
width: 70px;
|
||||
&:hover {
|
||||
color: #303133;
|
||||
//background-color: #e6e6e6;
|
||||
}
|
||||
&:first-child {
|
||||
margin-left: 20px;
|
||||
}
|
||||
&:last-child {
|
||||
padding: 6px 18px 6px 18px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
.el-submenu.is-opened {
|
||||
@ -118,10 +124,12 @@ export default {
|
||||
}
|
||||
.icons-title {
|
||||
display: inline-block;
|
||||
padding-bottom: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.el-menu--popup-bottom-start {
|
||||
margin-top: 0px!important;
|
||||
margin-top: 0!important;
|
||||
}
|
||||
.el-menu-item.is-active {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,4 +1,3 @@
|
||||
import Layout from '@/layout/index'
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
/**
|
||||
@ -6,26 +5,6 @@ import i18n from '@/i18n/i18n'
|
||||
* the routes that need to be dynamically loaded based on admin or user roles
|
||||
*/
|
||||
export default [
|
||||
{
|
||||
path: '/users/first-login',
|
||||
component: Layout,
|
||||
meta: { title: i18n.t('route.UserFirstLogin'), icon: 'user' },
|
||||
children: [
|
||||
{
|
||||
path: 'personal-information-improvement/',
|
||||
component: () => import('@/views/profile/UserFirstLogin/PersonalInformationImprovement/index'),
|
||||
name: 'PersonalInformationImprovement',
|
||||
meta: { title: i18n.t('route.PersonalInformationImprovement') }
|
||||
},
|
||||
{
|
||||
path: 'guide/',
|
||||
component: () => import('@/views/profile/UserFirstLogin/UserGuide/index'),
|
||||
name: 'UserGuide',
|
||||
meta: { title: i18n.t('route.UserGuide') }
|
||||
}
|
||||
],
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/ops/celery/task/:id/log/',
|
||||
component: () => import('@/views/ops/CeleryTaskLog'),
|
||||
|
@ -17,7 +17,7 @@ export default {
|
||||
{
|
||||
path: '/profile/info',
|
||||
name: 'ProfileInfo',
|
||||
component: () => import('@/views/profile/UserProfile/ProfileInfo'),
|
||||
component: () => import('@/views/profile/ProfileInfo'),
|
||||
meta: {
|
||||
title: i18n.t('users.AccountInformation'),
|
||||
icon: 'adjust',
|
||||
@ -26,13 +26,20 @@ export default {
|
||||
},
|
||||
{
|
||||
path: '/profile/setting',
|
||||
name: 'profileSetting',
|
||||
component: () => import('@/views/profile/UserProfile/index'),
|
||||
name: 'ProfileSetting',
|
||||
component: () => import('@/views/profile/ProfileUpdate/index'),
|
||||
meta: {
|
||||
title: i18n.t('users.PersonalSetting'),
|
||||
icon: 'user-circle',
|
||||
permissions: []
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/profile/improvement',
|
||||
component: () => import('@/views/profile/ProfileImprovement'),
|
||||
name: 'ProfileImprovement',
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('route.PersonalInformationImprovement'), permissions: [] }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -15,10 +15,6 @@ function reject(msg) {
|
||||
return new Promise((resolve, reject) => reject(msg))
|
||||
}
|
||||
|
||||
// function setHeadTitle({ to, from, next }) {
|
||||
// document.title = getPageTitle(to.meta.title)
|
||||
// }
|
||||
|
||||
async function checkLogin({ to, from, next }) {
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
next()
|
||||
@ -69,12 +65,11 @@ async function changeCurrentOrgIfNeed({ to, from, next }) {
|
||||
await refreshCurrentOrg()
|
||||
const currentOrg = store.getters.currentOrg
|
||||
if (!currentOrg || typeof currentOrg !== 'object') {
|
||||
// console.log('Not has current org')
|
||||
orgUtil.change2PropOrg()
|
||||
return reject('Change prop org')
|
||||
}
|
||||
if (!orgUtil.hasCurrentOrgPermission()) {
|
||||
console.debug('Not has current org permission')
|
||||
console.error('Not has current org permission')
|
||||
orgUtil.change2PropOrg()
|
||||
return reject('Change prop org')
|
||||
}
|
||||
@ -109,11 +104,6 @@ export async function generatePageRoutes({ to, from, next }) {
|
||||
|
||||
try {
|
||||
// try get user profile
|
||||
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
||||
// 不能改名 current_org_roles, 里面返回的就是这个
|
||||
// const currentRole = store.getters.currentRole
|
||||
// console.log('Current org role: ', currentRole, rolec.getRolesDisplay(currentRole))
|
||||
|
||||
// generate accessible routes map based on roles
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes', { to, from })
|
||||
|
||||
@ -134,7 +124,7 @@ export async function generatePageRoutes({ to, from, next }) {
|
||||
|
||||
export async function checkUserFirstLogin({ to, from, next }) {
|
||||
if (store.state.users.profile.is_first_login) {
|
||||
next('/users/first-login/personal-information-improvement/')
|
||||
next('/profile/information-improvement')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
<template>
|
||||
<IBox>
|
||||
<GenericCreateUpdateForm v-bind="$data" />
|
||||
</IBox>
|
||||
<GenericCreateUpdatePage v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
import { IBox } from '@/components'
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import { Required } from '@/components/DataForm/rules'
|
||||
|
||||
export default {
|
||||
name: 'ProfileUpdate',
|
||||
components: {
|
||||
GenericCreateUpdateForm,
|
||||
IBox
|
||||
GenericCreateUpdatePage
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
@ -82,7 +78,7 @@ export default {
|
||||
},
|
||||
onPerformSuccess() {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => this.$router.push({ name: 'UserGuide' }), 100)
|
||||
setTimeout(() => this.$router.push({ name: 'ProfileInfo' }), 100)
|
||||
},
|
||||
submitMethod() {
|
||||
return 'put'
|
@ -8,7 +8,7 @@
|
||||
|
||||
<script>
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import ProfileInfo from './ProfileInfo'
|
||||
import ProfileInfo from '../ProfileInfo'
|
||||
import ProfileUpdate from './ProfileUpdate'
|
||||
import PasswordUpdate from './PasswordUpdate'
|
||||
import SecretKeyUpdate from './SecretKeyUpdate'
|
@ -1,42 +0,0 @@
|
||||
<template>
|
||||
<GenericDetailPage :object.sync="user" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="user" />
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import PersonalInformationImprovement from './PersonalInformationImprovement'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GenericDetailPage,
|
||||
PersonalInformationImprovement
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
user: {},
|
||||
config: {
|
||||
title: this.$t('users.FirstLogin'),
|
||||
activeMenu: 'PersonalInformationImprovement',
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('users.ImprovePersonalInformation'),
|
||||
name: 'PersonalInformationImprovement'
|
||||
}
|
||||
],
|
||||
hasRightSide: false,
|
||||
actions: {
|
||||
detailApiUrl: '/api/v1/users/profile/'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,43 +0,0 @@
|
||||
<template>
|
||||
<IBox>
|
||||
<div>
|
||||
<span>{{ describe }}</span>
|
||||
<el-link type="success" :href="guide.url">{{ guide.label }}</el-link>
|
||||
</div>
|
||||
</IBox>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { IBox } from '@/components'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
IBox
|
||||
},
|
||||
props: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
describe: this.$t('users.DescribeOfGuide'),
|
||||
guide: {
|
||||
url: '',
|
||||
label: this.$t('users.Guide')
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
const data = await this.getObject()
|
||||
this.guide.url = data.guide_url
|
||||
},
|
||||
methods: {
|
||||
getObject() {
|
||||
const url = `/api/v1/users/profile/`
|
||||
return this.$axios.get(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,42 +0,0 @@
|
||||
<template>
|
||||
<GenericDetailPage :object.sync="user" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="user" />
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import Guide from './Guide'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GenericDetailPage,
|
||||
Guide
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
user: {},
|
||||
config: {
|
||||
title: this.$t('users.FirstLogin'),
|
||||
activeMenu: 'Guide',
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('users.Guide'),
|
||||
name: 'Guide'
|
||||
}
|
||||
],
|
||||
hasRightSide: false,
|
||||
actions: {
|
||||
detailApiUrl: '/api/v1/users/profile/'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user