🔒 Add Discord admin user permissions and update developer access check logic
This commit is contained in:
@@ -98,20 +98,14 @@ export function useDiscordOAuth() {
|
||||
|
||||
/**
|
||||
* Check if user is allowed to access developer tools
|
||||
* Compares Discord username against backend-managed allowlist
|
||||
* Checks permissions returned from backend during OAuth
|
||||
*
|
||||
* @param {Object} userPermissions - User permissions object from backend
|
||||
* @returns {boolean} True if user has developer access
|
||||
*/
|
||||
function hasDevAccess(userPermissions = {}) {
|
||||
// Check explicit permission
|
||||
if (userPermissions?.includes?.('developer_tools.view')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Backend could also return discord_username_allowlist
|
||||
// This would be checked server-side, but frontend can cache it
|
||||
return false;
|
||||
function hasDevAccess() {
|
||||
// Check if tokens include permissions
|
||||
const permissions = oauth.tokens.value?.permissions || [];
|
||||
return permissions.includes('developer_tools.view');
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user