Skip to content
Snippets Groups Projects
Commit 6e6f1a05 authored by Janis Daniel Dähne's avatar Janis Daniel Dähne
Browse files

- locking exercise now keeps the owner

- owner can always lock exercise even if he has no group permission
- we now send back the owner for the exercises (overview)
- some auto formatting
parent 2d942474
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ namespace ClientServer.Helpers
/// </summary>
public static class Constants
{
public static string VersionString = "2.2.9";
public static string VersionString = "2.2.10";
/// <summary>
/// the port to use
......
......@@ -1328,6 +1328,8 @@ namespace ClientServer.Controllers.Core.Exercises
{
if (!await base.IsLoggedIn()) return;
int userId = GetUserId();
var exercise = await _context.Exercises
.FirstOrDefaultAsync(p => p.Id == exerciseId);
......@@ -1351,20 +1353,22 @@ namespace ClientServer.Controllers.Core.Exercises
return;
}
//moving an exercise is like changing...
if (
!base.HasGroupPermission(targetUserGroup.Id,
permission => permission != null && permission.CanLockExercisesPermanently))
if (exercise.UserId != userId) //owner can always lock
{
await
Response.WriteAsync(
Jc.Serialize(new BasicResponse(ResponseCode.NoPermission, "no permission")));
return;
//moving an exercise is like changing...
if (
!base.HasGroupPermission(targetUserGroup.Id,
permission => permission != null && permission.CanLockExercisesPermanently))
{
await
Response.WriteAsync(
Jc.Serialize(new BasicResponse(ResponseCode.NoPermission, "no permission")));
return;
}
}
exercise.IsPermanentlyLocked = true;
exercise.IsOnlyVisibleToOwner = false;
exercise.UserId = null;
try
{
......
......@@ -28,7 +28,7 @@ namespace ClientServer.Models.Users
/// </summary>
public bool CanCreateRoles { get; set; }
/// <summary>
/// true: can change roles, false: not
/// true: can change roles (update role permissions), false: not
/// TODO MAYBE system roles AND group roles currently
/// </summary>
public bool CanChangeRoles { get; set; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment