change user permission

This commit is contained in:
sylor_huang@126.com 2020-07-02 14:13:04 +08:00
parent 6b11852d1c
commit 221cf4fa81
7 changed files with 74 additions and 13 deletions

View File

@ -29,9 +29,17 @@ class MergeForm extends Component {
}
componentDidMount = () => {
this.check_is_login();
this.get_default_selects();
this.set_defatul();
};
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
};
get_default_selects = () => {
const { projectsId } = this.props.match.params;
this.setState({ isSpin: true });

View File

@ -41,21 +41,22 @@ class Index extends Component {
ignore_name: undefined
}
}
getUserInfo = () => {
const url = `/users/me.json`;
axios.get(url).then(result => {
if (result && result.data.login) {
this.setState({
current_user: result.data
})
this.getDetail();
}
}).catch(error => {
console.log(error)
})
}
// getUserInfo = () => {
// const url = `/users/me.json`;
// axios.get(url).then(result => {
// if (result && result.data.login) {
// this.setState({
// current_user: result.data
// })
// this.getDetail();
// }
// }).catch(error => {
// console.log(error)
// })
// }
componentDidMount = () => {
// this.getUserInfo();
this.check_is_login()
// 获取项目类别
this.getCategory();
// 获取项目语言
@ -64,6 +65,14 @@ class Index extends Component {
this.getGitignore();
// 获取开源许可证
this.getLicenses();
}
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
}
getCategory = () => {
const url = `/project_categories.json`

View File

@ -17,6 +17,17 @@ class NewMilepost extends Component {
}
}
componentDidMount = () => {
this.check_is_login();
};
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
};
onPanelChange = (time, mode) => {
this.setState({
value: time

View File

@ -38,9 +38,17 @@ class order_form extends Component {
}
componentDidMount = () => {
this.check_is_login()
this.getSelectList();
this.get_detail();
};
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
}
get_detail = () => {
const { form_type } = this.props;
if (form_type === "new") {

View File

@ -56,11 +56,20 @@ class Collaborator extends Component {
}
componentDidMount = () => {
this.check_is_login()
if (this.props.project_id) {
this.getMember();
}
};
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
};
componentDidUpdate = (prevState) => {
if (
this.props.project_id &&

View File

@ -19,10 +19,18 @@ class Setting extends Component {
}
componentDidMount = () => {
this.check_is_login()
this.getCategory();
this.getLanguage();
this.getInfo();
};
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
};
getLanguage = () => {
const url = `/project_languages.json`;
axios

View File

@ -51,8 +51,16 @@ class NewTags extends Component {
}
componentDidMount = () => {
this.check_is_login();
this.getList();
};
check_is_login =() =>{
const { current_user } = this.props;
if(!current_user){
this.props.history.push("/403")
return
}
};
getList = (page, order_name, order_type) => {
const { projectsId } = this.props.match.params;