- Model: deepseek/deepseek-chat-v3-0324
- Tokens Total: 132,376
- Input Tokens (+tools): 125,885
- Reasoning Tokens: 0
- Output Tokens: 6,491
- Cost: $0.044814
Of course! Integrating Oso Cloud with a Wagtail application is a fantastic way to handle sophisticated permissions beyond what's available out-of-the-box. Since Wagtail is built on Django, we'll be using the Python SDK and focusing on how to model Wagtail's concepts like Pages, Users, and Groups within Oso.
Let's walk through this step-by-step, following a similar path to the Oso Cloud Quickstart, but tailored specifically for your Wagtail project.
We'll implement a role-based access control (RBAC) system where users can be assigned "Editor" or "Viewer" roles on specific sections of your Wagtail site (i.e., on specific Page nodes and their descendants).
This file contains hidden or 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
| {"schemaVersion": 1, "label": "tests", "message": "passing", "color": "brightgreen"} |
This file contains hidden or 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
| {"schemaVersion": 1, "label": "coverage", "message": "0%", "color": "red"} |
This file contains hidden or 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
| rules_version = '2'; | |
| service firebase.storage { | |
| match /b/{bucket}/o { | |
| function isSignedIn() { | |
| return request.auth != null; | |
| } | |
| function isUser(userId) { | |
| return request.auth.uid == userId; | |
| } |
This file contains hidden or 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
| import firebase_admin | |
| from firebase_admin import firestore, storage | |
| from flask import abort | |
| from google.cloud.firestore_v1.base_document import DocumentSnapshot | |
| import app.config | |
| firebase_app = firebase_admin.initialize_app(options={"storageBucket": app.config.FIREBASE_STORAGE_BUCKET}) | |
| bucket = storage.bucket() | |
| db = firestore.client() |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| #include <ogg/ogg.h> | |
| #include <opus/opus.h> | |
| #define SAMPLE_RATE_HZ 48000 | |
| #define CHANNELS 1 | |
| #define MAX_PACKET_SIZE 2048 |
This file contains hidden or 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
| dataLayer.push({ | |
| 'event': 'Docs Copy To Clipboard With Keyboard', | |
| 'eventCallback': function() { | |
| document.addEventListener('copy', function(e) { | |
| dataLayer.push({ | |
| 'event': 'Docs Copy To Clipboard With Keyboard' | |
| }); | |
| }); | |
| } | |
| }); |