Erlaube berechtigten Konten, verknüpfte Originale über die Zugänge des Owners zu lesen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
562c0848b1
commit
75a3949f7c
14 files changed
+815
-93
No files matched your search
@@ -320,17 +320,20 @@ function kindLabel(element) {
|
||||
return kind;
|
||||
}
|
||||
|
||||
export function ShareBox({ path, grants, onChange }) {
|
||||
export function ShareBox({ path, grants, onChange, allowSources = false }) {
|
||||
const [email, setEmail] = useState("");
|
||||
const [canEdit, setCanEdit] = useState(true);
|
||||
const [canShare, setCanShare] = useState(false);
|
||||
const [useOwnerSources, setUseOwnerSources] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
async function submit(event) {
|
||||
event.preventDefault();
|
||||
setError("");
|
||||
const body = { email, can_read: true, can_edit: canEdit, can_share: canShare };
|
||||
if (allowSources) body.use_owner_sources = useOwnerSources;
|
||||
try {
|
||||
await api(path, { method: "POST", body: { email, can_read: true, can_edit: canEdit, can_share: canShare } });
|
||||
await api(path, { method: "POST", body });
|
||||
setEmail("");
|
||||
onChange();
|
||||
} catch (err) {
|
||||
@@ -354,6 +357,12 @@ export function ShareBox({ path, grants, onChange }) {
|
||||
</label>
|
||||
<label className="check"><input type="checkbox" checked={canEdit} onChange={(event) => setCanEdit(event.target.checked)} /> Bearbeiten</label>
|
||||
<label className="check"><input type="checkbox" checked={canShare} onChange={(event) => setCanShare(event.target.checked)} /> Weitergeben</label>
|
||||
{allowSources ? (
|
||||
<label className="check">
|
||||
<input type="checkbox" checked={useOwnerSources} onChange={(event) => setUseOwnerSources(event.target.checked)} />
|
||||
Verknüpfte Originale über meine Zugänge zeigen
|
||||
</label>
|
||||
) : null}
|
||||
<button type="submit">Freigeben</button>
|
||||
<ErrorNote error={error} />
|
||||
</form>
|
||||
@@ -362,7 +371,11 @@ export function ShareBox({ path, grants, onChange }) {
|
||||
{grants.map((grant) => (
|
||||
<li key={grant.id}>
|
||||
<span>{grant.display_name} · {grant.email}</span>
|
||||
<small>{grant.can_edit ? "Bearbeiten" : "Lesen"}{grant.can_share ? ", Weitergeben" : ""}</small>
|
||||
<small>
|
||||
{grant.can_edit ? "Bearbeiten" : "Lesen"}
|
||||
{grant.can_share ? ", Weitergeben" : ""}
|
||||
{grant.use_owner_sources ? ", Originale über meine Zugänge" : ""}
|
||||
</small>
|
||||
<button type="button" className="quiet" onClick={() => revoke(grant.id)}>Entziehen</button>
|
||||
</li>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user