mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
fix permissions from last refactor
This commit is contained in:
1 parent
9a0366c970
commit
83da090ba1
5 files changed
+20
-10
No files matched your search
@@ -84,6 +84,10 @@ class ApiConfig {
|
||||
return `${this.getScheme()}://${this.getNewApiHost()}/w2l/template/${templateSlug}/moderate`;
|
||||
}
|
||||
|
||||
deleteW2l(templateSlug: string) : string {
|
||||
return `${this.getScheme()}://${this.getNewApiHost()}/w2l/template/${templateSlug}/delete`;
|
||||
}
|
||||
|
||||
viewW2lInferenceResult(token: string) : string {
|
||||
return `${this.getScheme()}://${this.getNewApiHost()}/w2l/result/${token}`;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,14 @@ export interface UserInfo {
|
||||
// Contribution
|
||||
can_upload_tts_models: boolean,
|
||||
can_upload_w2l_templates: boolean,
|
||||
can_delete_own_tts_models: boolean,
|
||||
can_delete_own_w2l_templates: boolean,
|
||||
// Moderation
|
||||
can_ban_users: boolean,
|
||||
can_edit_other_users_data: boolean,
|
||||
can_approve_w2l_templates: boolean,
|
||||
can_edit_other_users_profiles: boolean,
|
||||
can_edit_other_users_tts_models: boolean,
|
||||
can_edit_other_users_w2l_templates: boolean,
|
||||
can_delete_other_users_tts_models: boolean,
|
||||
can_delete_other_users_w2l_templates: boolean,
|
||||
can_ban_users: boolean,
|
||||
}
|
||||
@@ -40,11 +40,11 @@ export class SessionWrapper {
|
||||
return this.sessionStateResponse?.user?.email_gravatar_hash;
|
||||
}
|
||||
|
||||
public canEditUser(username: string) : boolean {
|
||||
public canEditUserProfile(username: string) : boolean {
|
||||
if (this.getUsername() === username) {
|
||||
return true;
|
||||
}
|
||||
return this.canEditOtherUsersData();
|
||||
return this.canEditOtherUsersProfiles();
|
||||
}
|
||||
|
||||
public canUseTts() : boolean {
|
||||
@@ -67,8 +67,8 @@ export class SessionWrapper {
|
||||
return this.sessionStateResponse?.user?.can_ban_users || false;
|
||||
}
|
||||
|
||||
public canEditOtherUsersData() : boolean {
|
||||
return this.sessionStateResponse?.user?.can_edit_other_users_data || false;
|
||||
public canEditOtherUsersProfiles() : boolean {
|
||||
return this.sessionStateResponse?.user?.can_edit_other_users_profiles || false;
|
||||
}
|
||||
|
||||
public canApproveW2lTemplates() : boolean {
|
||||
|
||||
@@ -84,7 +84,7 @@ function ProfileFc(props: Props) {
|
||||
|
||||
let editProfileButton = <span />
|
||||
|
||||
if (props.sessionWrapper.canEditUser(username)) {
|
||||
if (props.sessionWrapper.canEditUserProfile(username)) {
|
||||
let editLinkUrl = `/profile/${username}/edit`;
|
||||
editProfileButton = (
|
||||
<Link
|
||||
|
||||
@@ -94,7 +94,7 @@ function ProfileEditFc(props: Props) {
|
||||
|
||||
}, [username]); // NB: Empty array dependency sets to run ONLY on mount
|
||||
|
||||
if (!props.sessionWrapper.canEditUser(username)) {
|
||||
if (!props.sessionWrapper.canEditUserProfile(username)) {
|
||||
history.push(userProfilePage);
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ function ProfileEditFc(props: Props) {
|
||||
history.push(userProfilePage);
|
||||
}
|
||||
})
|
||||
//.catch(e => {
|
||||
//});
|
||||
.catch(e => {
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user