Files
radio.org.tr/public/decapcms/index.html
T

50 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<title>ARC İçerik Yöneticisi</title>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
<!-- Include the script that builds the page and powers Decap CMS -->
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
<script>
// Initialize Netlify Identity widget with role checking
if (window.netlifyIdentity) {
window.netlifyIdentity.on('init', (user) => {
if (!user) {
window.netlifyIdentity.on('login', () => {
document.location.href = '/admin/';
});
} else {
// Check if user has required roles
checkUserRole(user);
}
});
window.netlifyIdentity.on('login', (user) => {
checkUserRole(user);
});
}
function checkUserRole(user) {
const allowedRoles = ['admin', 'editor'];
const userRoles = user.app_metadata?.roles || [];
// Check if user has any of the allowed roles
const hasAccess = allowedRoles.some(role => userRoles.includes(role));
if (!hasAccess) {
// User doesn't have required roles
alert('Erişim reddedildi. Bu alanı kullanmak için yönetici izni gereklidir.');
window.netlifyIdentity.logout();
window.location.href = '/';
return;
}
}
</script>
</body>
</html>