Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-50440 Rubrics remove sharing of public rubrics from other sites #12839

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Aniii10
Copy link
Contributor

@Aniii10 Aniii10 commented Sep 3, 2024

In the rubrics section, the public rubrics that are displayed must be able to be unpublished or deleted from any site other than the original. This is important for institutions with hundreds of shared rubrics or when the original instructor no longer belongs to the institution.

The development has been sponsored by Hotelschool.

@bgarciaentornos bgarciaentornos marked this pull request as draft September 3, 2024 07:11
@bgarciaentornos
Copy link
Contributor

Leaving this as a draft, as Christina requested that these actions should be shown only to superusers. We're working on that but we'd like to have this included in 25 so creating the PR before the freeze date.

Comment on lines 80 to 82
refreshPage() {
window.location.reload();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is no longer used and it could be removed

@@ -19,6 +19,7 @@ save=Gorde
done=Egina
total=Guztira
confirm_remove=Ziur zaude kendu egin nahi duzula?
confirm_remove_public=Ziur "{}" publikoki partekatutako errubriketatik eta webgunearen jatorritik kendu nahi duzula?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PabloSanRoman can you check this, please?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bgarciaentornos!
Best with a little change:

  • confirm_remove_public= Ziur kendu nahi duzula errubrika hau, "{}", publikoki partekatutako errubriketatik eta gunetik bertatik?

this.fetchUserRoles();
}

async fetchUserRoles() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this to checkSuperUser (we're not actually getting other roles)

Comment on lines 21 to 22
@GetMapping("/user/roles")
public ResponseEntity<Map<String, Boolean>> getUserRoles() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this to checkSuperUser (we're not actually getting other roles)

const roles = await response.json();
this.isSuperUser = roles.isSuperUser;

console.log("Is SuperUser:", this.isSuperUser);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log("Is SuperUser:", this.isSuperUser);
console.debug("Is SuperUser:", this.isSuperUser);

@bgarciaentornos bgarciaentornos marked this pull request as ready for review September 4, 2024 10:17
Copy link
Contributor

@bgarciaentornos bgarciaentornos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianfish Can you take a look, please?

@ern ern changed the title SAK-50440: Public Rubrics - Unpublished and Deleted SAK-50440 Rubrics remove sharing for public rubrics Sep 10, 2024
@ern ern changed the title SAK-50440 Rubrics remove sharing for public rubrics SAK-50440 Rubrics remove sharing of public rubrics from other sites Sep 10, 2024
@adrianfish adrianfish self-requested a review September 19, 2024 16:37
@@ -21,6 +21,7 @@ save=Save
done=Done
total=Total
confirm_remove=Are you sure you want to remove "{}" ?
confirm_remove_public=Are you sure you want to remove "{}" both from publicly shared rubrics and from its site origin?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the word "public". This implies that these rubrics are visible to people who are not Sakai users, the public.

@@ -21,6 +21,7 @@ save=Save
done=Done
total=Total
confirm_remove=Are you sure you want to remove "{}" ?
confirm_remove_public=Are you sure you want to remove "{}" both from publicly shared rubrics and from its site origin?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
confirm_remove_public=Are you sure you want to remove "{}" both from publicly shared rubrics and from its site origin?
confirm_remove_shared=Are you sure you want to remove "{}" both from shared rubrics and from its source site?

@@ -18,6 +18,7 @@ save=Desa
done=Fet
total=Total
confirm_remove=Esteu segur de voler-ho eliminar
confirm_remove_public=Esteu segur que voleu eliminar "{}" tant de les r\u00fabriques compartides p\u00fablicament com del seu origen del lloc?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
confirm_remove_public=Esteu segur que voleu eliminar "{}" tant de les r\u00fabriques compartides p\u00fablicament com del seu origen del lloc?
confirm_remove_shared=Esteu segur que voleu eliminar "{}" tant de les r\u00fabriques compartides p\u00fablicament com del seu origen del lloc?

@@ -20,6 +20,7 @@ save=Guardar
done=Aceptar
total=Total
confirm_remove=\u00bfEst\u00e1s seguro de que deseas borrar "{}"?
confirm_remove_public=\u00bfEst\u00e1s seguro de que deseas borrar "{}", tanto de las r\u00fabricas compartidas p\u00fablicamente como del sitio de origen?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
confirm_remove_public=\u00bfEst\u00e1s seguro de que deseas borrar "{}", tanto de las r\u00fabricas compartidas p\u00fablicamente como del sitio de origen?
confirm_remove_shared=\u00bfEst\u00e1s seguro de que deseas borrar "{}", tanto de las r\u00fabricas compartidas p\u00fablicamente como del sitio de origen?

@@ -19,6 +19,7 @@ save=Gorde
done=Egina
total=Guztira
confirm_remove=Ziur zaude kendu egin nahi duzula?
confirm_remove_public=Ziur "{}" publikoki partekatutako errubriketatik eta webgunearen jatorritik kendu nahi duzula?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
confirm_remove_public=Ziur "{}" publikoki partekatutako errubriketatik eta webgunearen jatorritik kendu nahi duzula?
confirm_remove_shared=Ziur "{}" publikoki partekatutako errubriketatik eta webgunearen jatorritik kendu nahi duzula?

Comment on lines +24 to +29
Map<String, Boolean> roles = new HashMap<>();
roles.put("isSuperUser", securityService.isSuperUser());

return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_JSON)
.body(roles);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Map<String, Boolean> roles = new HashMap<>();
roles.put("isSuperUser", securityService.isSuperUser());
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_JSON)
.body(roles);
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_JSON)
.body(Map.of("isSuperUser", securityService.isSuperUser()));

this.enablePdfExport = false;
this.checkSuperUser();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really bad idea. If we have 100 shared rubrics on a page, that's 100 fetch requests. Instead, you should think in terms of setting is-super-user on the actual tag as an attribute and supplying that once. Look in the RubricsController and look at how enablePdfExport is supplied from the controller. You will need to set that attribute on the list and shared list components so they can then set it on the readonly rubric tags. But, that is a lot better than firing off 100s of fetch requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants