diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index e459787..15d2c8b 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -332,6 +332,10 @@ class CCPMethodList extends HTMLElement{ }).catch(err=>{ alert(err)}) } + isShared(process){ + return 0 < process.metadata.filter(md=>{ return md.role === "context" && mt.title === this.#boot.context}) + } + isAuthor(m){ const href = `${this.#boot.url}/admin/realms/${this.#boot.realm}/users/${this.#boot.subject}` const found = m.metadata.filter(md=>{return md.role === "author" && md.href === href}) @@ -447,7 +451,16 @@ class CCPMethodList extends HTMLElement{ }, { target: "button[name=publish]", - apply : (e,d)=>{ e.style.display = this.isAuthor(d) ? "revert" : "none" } + apply : (e,d)=>{ + if(this.isShared(d)){ + const span = document.createElement("span") + span.classList.add("bg-warning") + span.textContent = "shared" + e.replaceWith(span) + }else if(!this.isAuthor(d)){ + e.parentElement.removeChild(e) + } + } }, { target : "span[name=author]",