-
-
Notifications
You must be signed in to change notification settings - Fork 928
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
Aniii10
wants to merge
3
commits into
sakaiproject:master
Choose a base branch
from
Aniii10:SAK-50440
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
webapi/src/main/java/org/sakaiproject/webapi/controllers/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.sakaiproject.webapi.controllers; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.sakaiproject.authz.api.SecurityService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@RestController | ||
@Slf4j | ||
public class UserController extends AbstractSakaiApiController{ | ||
|
||
@Autowired | ||
private SecurityService securityService; | ||
|
||
@GetMapping("/user/roles") | ||
public ResponseEntity<Map<String, Boolean>> checkSuperUser() { | ||
|
||
Map<String, Boolean> roles = new HashMap<>(); | ||
roles.put("isSuperUser", securityService.isSuperUser()); | ||
|
||
return ResponseEntity.ok() | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.body(roles); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,14 +8,36 @@ export class SakaiRubricReadonly extends SakaiRubric { | |||||
static properties = { | ||||||
|
||||||
rubric: { type: Object }, | ||||||
isSuperUser: { type: Boolean }, | ||||||
enablePdfExport: { attribute: "enable-pdf-export", type: Boolean }, | ||||||
}; | ||||||
|
||||||
constructor() { | ||||||
|
||||||
super(); | ||||||
|
||||||
this.isSuperUser = false; | ||||||
this.enablePdfExport = false; | ||||||
this.checkSuperUser(); | ||||||
} | ||||||
|
||||||
async checkSuperUser() { | ||||||
try { | ||||||
const response = await fetch("/api/user/roles", { | ||||||
method: "GET", | ||||||
credentials: "include", | ||||||
}); | ||||||
|
||||||
if (!response.ok) { | ||||||
throw new Error(`HTTP error! status: ${response.status}`); | ||||||
} | ||||||
|
||||||
const roles = await response.json(); | ||||||
this.isSuperUser = roles.isSuperUser; | ||||||
|
||||||
console.log("Is SuperUser:", this.isSuperUser); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} catch (error) { | ||||||
console.error("Error fetching user roles:", error); | ||||||
} | ||||||
} | ||||||
|
||||||
shouldUpdate() { return this.rubric; } | ||||||
|
@@ -54,6 +76,12 @@ export class SakaiRubricReadonly extends SakaiRubric { | |||||
<div class="d-none d-sm-block">${this.rubric.formattedModifiedDate}</div> | ||||||
|
||||||
<div class="actions"> | ||||||
${this.isSuperUser ? html` | ||||||
<div class="action-container"> | ||||||
<span class="d-none d-sm-none d-md-block visually-hidden">${this._i18n.delete_rubric}</span> | ||||||
<span role="button" title="${this._i18n.revoke.replace("{}", this.rubric.title)}" tabindex="0" class="fa fa-users" @click="${this.revokeShareRubric}"></span> | ||||||
</div> | ||||||
` : ""} | ||||||
<div class="action-container"> | ||||||
<span class="d-none d-sm-none d-md-block visually-hidden">${this._i18n.copy}</span> | ||||||
<span role="button" title="${this._i18n.copy_to_site.replace("{}", this.rubric.title)}" tabindex="0" class="clone fa fa-copy" @click="${this.copyToSite}"></span> | ||||||
|
@@ -67,6 +95,12 @@ export class SakaiRubricReadonly extends SakaiRubric { | |||||
</sakai-rubric-pdf> | ||||||
</div> | ||||||
` : ""} | ||||||
${this.isSuperUser ? html` | ||||||
<div class="action-container"> | ||||||
<span class="d-none d-sm-none d-md-block visually-hidden">${this._i18n.delete_rubric}</span> | ||||||
<span role="button" title="${this._i18n.remove.replace("{}", this.rubric.title)}" tabindex="0" class="fa fa-times" @click="${this.deleteRubric}"></span> | ||||||
</div> | ||||||
` : ""} | ||||||
</div> | ||||||
</div> | ||||||
|
||||||
|
@@ -83,4 +117,14 @@ export class SakaiRubricReadonly extends SakaiRubric { | |||||
e.stopPropagation(); | ||||||
this.dispatchEvent(new CustomEvent("copy-to-site", { detail: this.rubric.id })); | ||||||
} | ||||||
|
||||||
deleteRubric(e) { | ||||||
e.stopPropagation(); | ||||||
this.dispatchEvent(new CustomEvent("delete-rubric", { detail: { id: this.rubric.id, title: this.rubric.title }, bubbles: true, composed: true, })); | ||||||
} | ||||||
|
||||||
revokeShareRubric(e) { | ||||||
e.stopPropagation(); | ||||||
this.dispatchEvent(new CustomEvent("revoke-shared-rubric", { detail: { id: this.rubric.id, title: this.rubric.title, shared: this.rubric.shared }, bubbles: true, composed: true, })); | ||||||
} | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: