Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/halo-dev/halo into feat/add…
Browse files Browse the repository at this point in the history
…-external-transfer
  • Loading branch information
LIlGG committed Aug 21, 2024
2 parents 728366a + ad81f6d commit 9526cb4
Show file tree
Hide file tree
Showing 47 changed files with 2,677 additions and 2,682 deletions.
152 changes: 93 additions & 59 deletions api-docs/openapi/v3_0/aggregated.json
Original file line number Diff line number Diff line change
Expand Up @@ -5269,55 +5269,6 @@
]
}
},
"/apis/api.console.migration.halo.run/v1alpha1/backups/{name}/files/{filename}": {
"get": {
"operationId": "DownloadBackups",
"parameters": [
{
"description": "Backup name.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Backup filename.",
"in": "path",
"name": "filename",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/api.console.migration.halo.run/v1alpha1/restorations": {
"post": {
"description": "Restore backup by uploading file or providing download link or backup name.",
"operationId": "RestoreBackup",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/RestoreRequest"
}
}
},
"required": true
},
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/api.content.halo.run/v1alpha1/categories": {
"get": {
"description": "Lists categories.",
Expand Down Expand Up @@ -6789,14 +6740,6 @@
"type": "string"
}
}
},
{
"description": "Keyword",
"in": "query",
"name": "keyword",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -7449,6 +7392,79 @@
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backup-files": {
"get": {
"description": "Get backup files from backup root.",
"operationId": "getBackupFiles",
"responses": {
"default": {
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BackupFile"
}
}
}
},
"description": "default response"
}
},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backups/{name}/files/{filename}": {
"get": {
"operationId": "DownloadBackups",
"parameters": [
{
"description": "Backup name.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Backup filename.",
"in": "path",
"name": "filename",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/restorations": {
"post": {
"description": "Restore backup by uploading file or providing download link or backup name.",
"operationId": "RestoreBackup",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/RestoreRequest"
}
}
},
"required": true
},
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.notification.halo.run/v1alpha1/notifiers/default-email-notifier/verify-connection": {
"post": {
"description": "Verify email sender config.",
Expand Down Expand Up @@ -15379,6 +15395,22 @@
}
}
},
"BackupFile": {
"type": "object",
"properties": {
"filename": {
"type": "string"
},
"lastModifiedTime": {
"type": "string",
"format": "date-time"
},
"size": {
"type": "integer",
"format": "int64"
}
}
},
"BackupList": {
"required": [
"first",
Expand Down Expand Up @@ -20763,6 +20795,10 @@
"file": {
"type": "string",
"format": "binary"
},
"filename": {
"type": "string",
"description": "Filename of backup file in backups root."
}
}
},
Expand Down Expand Up @@ -22975,14 +23011,12 @@
}
},
"roles": {
"uniqueItems": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/Role"
}
},
"uiPermissions": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
Expand Down
112 changes: 110 additions & 2 deletions api-docs/openapi/v3_0/apis_console.api_v1alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,79 @@
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backup-files": {
"get": {
"description": "Get backup files from backup root.",
"operationId": "getBackupFiles",
"responses": {
"default": {
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BackupFile"
}
}
}
},
"description": "default response"
}
},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/backups/{name}/files/{filename}": {
"get": {
"operationId": "DownloadBackups",
"parameters": [
{
"description": "Backup name.",
"in": "path",
"name": "name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Backup filename.",
"in": "path",
"name": "filename",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.migration.halo.run/v1alpha1/restorations": {
"post": {
"description": "Restore backup by uploading file or providing download link or backup name.",
"operationId": "RestoreBackup",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/RestoreRequest"
}
}
},
"required": true
},
"responses": {},
"tags": [
"MigrationV1alpha1Console"
]
}
},
"/apis/console.api.notification.halo.run/v1alpha1/notifiers/default-email-notifier/verify-connection": {
"post": {
"description": "Verify email sender config.",
Expand Down Expand Up @@ -3406,6 +3479,22 @@
}
}
},
"BackupFile": {
"type": "object",
"properties": {
"filename": {
"type": "string"
},
"lastModifiedTime": {
"type": "string",
"format": "date-time"
},
"size": {
"type": "integer",
"format": "int64"
}
}
},
"Category": {
"required": [
"apiVersion",
Expand Down Expand Up @@ -5435,6 +5524,27 @@
}
}
},
"RestoreRequest": {
"type": "object",
"properties": {
"backupName": {
"type": "string",
"description": "Backup metadata name."
},
"downloadUrl": {
"type": "string",
"description": "Remote backup HTTP URL."
},
"file": {
"type": "string",
"format": "binary"
},
"filename": {
"type": "string",
"description": "Filename of backup file in backups root."
}
}
},
"RevertSnapshotForPostParam": {
"required": [
"snapshotName"
Expand Down Expand Up @@ -6288,14 +6398,12 @@
}
},
"roles": {
"uniqueItems": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/Role"
}
},
"uiPermissions": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.util.StringUtils;
import run.halo.app.extension.AbstractExtension;
import run.halo.app.extension.ExtensionOperator;
import run.halo.app.extension.GVK;
Expand Down Expand Up @@ -118,6 +119,14 @@ public static Predicate<Subject> containsUser(Set<String> usernames) {
&& User.GROUP.equals(subject.apiGroup)
&& usernames.contains(subject.getName());
}

@Override
public String toString() {
if (StringUtils.hasText(apiGroup)) {
return apiGroup + "/" + kind + "/" + name;
}
return kind + "/" + name;
}
}

public static RoleBinding create(String username, String roleName) {
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/run/halo/app/core/extension/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class User extends AbstractExtension {

public static final String HIDDEN_USER_LABEL = "halo.run/hidden-user";

public static final String REQUEST_TO_UPDATE = "halo.run/request-to-update";

@Schema(requiredMode = REQUIRED)
private UserSpec spec = new UserSpec();

Expand Down
Loading

0 comments on commit 9526cb4

Please sign in to comment.