[feat] Optional recursive

This commit is contained in:
acite
2025-09-20 14:22:08 +08:00
parent 3723ea32a7
commit a7c522a61f
2 changed files with 9 additions and 4 deletions

View File

@@ -11,6 +11,7 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="bf317275-3039-49bb-a475-725a800a0cce" name="Changes" comment=""> <list default="true" id="bf317275-3039-49bb-a475-725a800a0cce" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Abyss/Components/Controllers/Security/RootController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Controllers/Security/RootController.cs" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -223,6 +224,10 @@
<workItem from="1758121232981" duration="69000" /> <workItem from="1758121232981" duration="69000" />
<workItem from="1758279286341" duration="6796000" /> <workItem from="1758279286341" duration="6796000" />
<workItem from="1758303096075" duration="2560000" /> <workItem from="1758303096075" duration="2560000" />
<workItem from="1758307172642" duration="157000" />
<workItem from="1758307433345" duration="34000" />
<workItem from="1758344749532" duration="238000" />
<workItem from="1758345893755" duration="2662000" />
</task> </task>
<servers /> <servers />
</component> </component>

View File

@@ -11,7 +11,7 @@ public class RootController(ILogger<RootController> logger, UserService userServ
: BaseController : BaseController
{ {
[HttpPost("chmod")] [HttpPost("chmod")]
public async Task<IActionResult> Chmod(string token, string path, string permission) public async Task<IActionResult> Chmod(string token, string path, string permission, string? recursive)
{ {
logger.LogInformation("Chmod method called with path: {Path}, permission: {Permission}", path, permission); logger.LogInformation("Chmod method called with path: {Path}, permission: {Permission}", path, permission);
@@ -21,13 +21,13 @@ public class RootController(ILogger<RootController> logger, UserService userServ
return StatusCode(401, "Unauthorized"); return StatusCode(401, "Unauthorized");
} }
bool r = await resourceService.Chmod(path, token, permission, Ip, true); bool r = await resourceService.Chmod(path, token, permission, Ip, recursive == "true");
logger.LogInformation("Chmod operation completed with result: {Result}", r); logger.LogInformation("Chmod operation completed with result: {Result}", r);
return r ? Ok() : StatusCode(502); return r ? Ok() : StatusCode(502);
} }
[HttpPost("chown")] [HttpPost("chown")]
public async Task<IActionResult> Chown(string token, string path, int owner) public async Task<IActionResult> Chown(string token, string path, int owner, string? recursive)
{ {
logger.LogInformation("Chown method called with path: {Path}, owner: {Owner}", path, owner); logger.LogInformation("Chown method called with path: {Path}, owner: {Owner}", path, owner);
@@ -37,7 +37,7 @@ public class RootController(ILogger<RootController> logger, UserService userServ
return StatusCode(401, "Unauthorized"); return StatusCode(401, "Unauthorized");
} }
bool r = await resourceService.Chown(path, token, owner, Ip, true); bool r = await resourceService.Chown(path, token, owner, Ip, recursive == "true");
logger.LogInformation("Chown operation completed with result: {Result}", r); logger.LogInformation("Chown operation completed with result: {Result}", r);
return r ? Ok() : StatusCode(502); return r ? Ok() : StatusCode(502);
} }