Implement decoupled domain permissions bus with Netherite constitutional safeguards
This commit is contained in:
parent
f8129d26e6
commit
ea32bde3ac
5 changed files with 1030 additions and 28 deletions
214
config/permissions/domain_forgejo.json
Normal file
214
config/permissions/domain_forgejo.json
Normal file
|
|
@ -0,0 +1,214 @@
|
||||||
|
{
|
||||||
|
"team_priority": [
|
||||||
|
"guardian",
|
||||||
|
"iron",
|
||||||
|
"lapis",
|
||||||
|
"citizen"
|
||||||
|
],
|
||||||
|
"roles": {
|
||||||
|
"645629375060115466": {
|
||||||
|
"label": "citizen",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"650018103798923267": {
|
||||||
|
"label": "southern",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"880586135628288000": {
|
||||||
|
"label": "komrad",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"701395489916059648": {
|
||||||
|
"label": "internat",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"719994624839516202": {
|
||||||
|
"label": "eastern",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"975345120637501461": {
|
||||||
|
"label": "northern",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572742169926701109": {
|
||||||
|
"label": "western",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"645629751804952596": {
|
||||||
|
"label": "farmer",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572744082483187772": {
|
||||||
|
"label": "fighter",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"645629112991612938": {
|
||||||
|
"label": "miner",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"650019716563468320": {
|
||||||
|
"label": "builder",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"645629583957295105": {
|
||||||
|
"label": "scientist",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"645629213264838657": {
|
||||||
|
"label": "redstoner",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572746114396979240": {
|
||||||
|
"label": "clock.society",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"645628874964729878": {
|
||||||
|
"label": "writer",
|
||||||
|
"forgejo_team": "lapis"
|
||||||
|
},
|
||||||
|
"1572742637230751784": {
|
||||||
|
"label": "candidat",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572746804766965862": {
|
||||||
|
"label": "gamemaster",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574757244971655228": {
|
||||||
|
"label": "skulk.warden",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572688957362409482": {
|
||||||
|
"label": "amethyst.shard",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572687861407555745": {
|
||||||
|
"label": "budding.amethyst",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574800386630357213": {
|
||||||
|
"label": "ministry.diamond",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574800809122603200": {
|
||||||
|
"label": "ministry.emerald",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574800893419724861": {
|
||||||
|
"label": "ministry.netherite",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574801051251646666": {
|
||||||
|
"label": "ministry.iron",
|
||||||
|
"forgejo_team": "iron"
|
||||||
|
},
|
||||||
|
"1574801143530528991": {
|
||||||
|
"label": "ministry.copper",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574801204184219678": {
|
||||||
|
"label": "ministry.lapis",
|
||||||
|
"forgejo_team": "lapis"
|
||||||
|
},
|
||||||
|
"1574801694221537310": {
|
||||||
|
"label": "ministry.redstone",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574801756817465477": {
|
||||||
|
"label": "ministry.gold",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574801933854712018": {
|
||||||
|
"label": "ministry.quartz",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574802012954955828": {
|
||||||
|
"label": "ministry.resin",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1572684174895218818": {
|
||||||
|
"label": "guardian.amethyst",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572687298682687538": {
|
||||||
|
"label": "guardian.resin",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572686623743672363": {
|
||||||
|
"label": "guardian.quartz",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572685344153796749": {
|
||||||
|
"label": "guardian.gold",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572686978980388894": {
|
||||||
|
"label": "guardian.redstone",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572684601111879730": {
|
||||||
|
"label": "guardian.lapis",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572685733733601321": {
|
||||||
|
"label": "guardian.copper",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572686122721480734": {
|
||||||
|
"label": "guardian.iron",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572683357815316500": {
|
||||||
|
"label": "guardian.coal",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572683109999190128": {
|
||||||
|
"label": "guardian.netherite",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572682446665949344": {
|
||||||
|
"label": "guardian.emerald",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572681141528301588": {
|
||||||
|
"label": "guardian.diamond",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
},
|
||||||
|
"1572680750321369420": {
|
||||||
|
"label": "charcoal",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873782303195160": {
|
||||||
|
"label": "detective.chest",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873793833337073": {
|
||||||
|
"label": "detective.ender_chest",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873823444996116": {
|
||||||
|
"label": "detective.dropper",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873835688173748": {
|
||||||
|
"label": "detective.barrel",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873856269615235": {
|
||||||
|
"label": "detective.dispenser",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873864972795984": {
|
||||||
|
"label": "detective.hopper",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"1574873872011104346": {
|
||||||
|
"label": "detective.shulker",
|
||||||
|
"forgejo_team": "citizen"
|
||||||
|
},
|
||||||
|
"683346841265373195": {
|
||||||
|
"label": "founder",
|
||||||
|
"forgejo_team": "guardian"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
311
config/permissions/domain_minecraft.json
Normal file
311
config/permissions/domain_minecraft.json
Normal file
|
|
@ -0,0 +1,311 @@
|
||||||
|
{
|
||||||
|
"description": "Mapping Discord -> LuckPerms (ne remplace pas role_to_lp.json, pilote les mises a jour Netherite)",
|
||||||
|
"roles": {
|
||||||
|
"645629375060115466": {
|
||||||
|
"label": "citizen",
|
||||||
|
"lp_group": "citizen",
|
||||||
|
"weight": 10,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"650018103798923267": {
|
||||||
|
"label": "southern",
|
||||||
|
"lp_group": "southern",
|
||||||
|
"weight": 20,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"880586135628288000": {
|
||||||
|
"label": "komrad",
|
||||||
|
"lp_group": "komrad",
|
||||||
|
"weight": 20,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"701395489916059648": {
|
||||||
|
"label": "internat",
|
||||||
|
"lp_group": "internat",
|
||||||
|
"weight": 20,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"719994624839516202": {
|
||||||
|
"label": "eastern",
|
||||||
|
"lp_group": "eastern",
|
||||||
|
"weight": 20,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"975345120637501461": {
|
||||||
|
"label": "northern",
|
||||||
|
"lp_group": "northern",
|
||||||
|
"weight": 20,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572742169926701109": {
|
||||||
|
"label": "western",
|
||||||
|
"lp_group": "western",
|
||||||
|
"weight": 20,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"645629751804952596": {
|
||||||
|
"label": "farmer",
|
||||||
|
"lp_group": "farmer",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572744082483187772": {
|
||||||
|
"label": "fighter",
|
||||||
|
"lp_group": "fighter",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"645629112991612938": {
|
||||||
|
"label": "miner",
|
||||||
|
"lp_group": "miner",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"650019716563468320": {
|
||||||
|
"label": "builder",
|
||||||
|
"lp_group": "builder",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"645629583957295105": {
|
||||||
|
"label": "scientist",
|
||||||
|
"lp_group": "scientist",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"645629213264838657": {
|
||||||
|
"label": "redstoner",
|
||||||
|
"lp_group": "redstoner",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572746114396979240": {
|
||||||
|
"label": "clock.society",
|
||||||
|
"lp_group": "clock.society",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"645628874964729878": {
|
||||||
|
"label": "writer",
|
||||||
|
"lp_group": "writer",
|
||||||
|
"weight": 30,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572742637230751784": {
|
||||||
|
"label": "candidat",
|
||||||
|
"lp_group": "candidat",
|
||||||
|
"weight": 35,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572746804766965862": {
|
||||||
|
"label": "gamemaster",
|
||||||
|
"lp_group": "gamemaster",
|
||||||
|
"weight": 40,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574757244971655228": {
|
||||||
|
"label": "skulk.warden",
|
||||||
|
"lp_group": "skulk.warden",
|
||||||
|
"weight": 50,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572688957362409482": {
|
||||||
|
"label": "amethyst.shard",
|
||||||
|
"lp_group": "amethyst.shard",
|
||||||
|
"weight": 60,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572687861407555745": {
|
||||||
|
"label": "budding.amethyst",
|
||||||
|
"lp_group": "budding.amethyst",
|
||||||
|
"weight": 65,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574800386630357213": {
|
||||||
|
"label": "ministry.diamond",
|
||||||
|
"lp_group": "ministry.diamond",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574800809122603200": {
|
||||||
|
"label": "ministry.emerald",
|
||||||
|
"lp_group": "ministry.emerald",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574800893419724861": {
|
||||||
|
"label": "ministry.netherite",
|
||||||
|
"lp_group": "ministry.netherite",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574801051251646666": {
|
||||||
|
"label": "ministry.iron",
|
||||||
|
"lp_group": "ministry.iron",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574801143530528991": {
|
||||||
|
"label": "ministry.copper",
|
||||||
|
"lp_group": "ministry.copper",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574801204184219678": {
|
||||||
|
"label": "ministry.lapis",
|
||||||
|
"lp_group": "ministry.lapis",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574801694221537310": {
|
||||||
|
"label": "ministry.redstone",
|
||||||
|
"lp_group": "ministry.redstone",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574801756817465477": {
|
||||||
|
"label": "ministry.gold",
|
||||||
|
"lp_group": "ministry.gold",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574801933854712018": {
|
||||||
|
"label": "ministry.quartz",
|
||||||
|
"lp_group": "ministry.quartz",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574802012954955828": {
|
||||||
|
"label": "ministry.resin",
|
||||||
|
"lp_group": "ministry.resin",
|
||||||
|
"weight": 70,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572684174895218818": {
|
||||||
|
"label": "guardian.amethyst",
|
||||||
|
"lp_group": "guardian.amethyst",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572687298682687538": {
|
||||||
|
"label": "guardian.resin",
|
||||||
|
"lp_group": "guardian.resin",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572686623743672363": {
|
||||||
|
"label": "guardian.quartz",
|
||||||
|
"lp_group": "guardian.quartz",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572685344153796749": {
|
||||||
|
"label": "guardian.gold",
|
||||||
|
"lp_group": "guardian.gold",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572686978980388894": {
|
||||||
|
"label": "guardian.redstone",
|
||||||
|
"lp_group": "guardian.redstone",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572684601111879730": {
|
||||||
|
"label": "guardian.lapis",
|
||||||
|
"lp_group": "guardian.lapis",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572685733733601321": {
|
||||||
|
"label": "guardian.copper",
|
||||||
|
"lp_group": "guardian.copper",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572686122721480734": {
|
||||||
|
"label": "guardian.iron",
|
||||||
|
"lp_group": "guardian.iron",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572683357815316500": {
|
||||||
|
"label": "guardian.coal",
|
||||||
|
"lp_group": "guardian.coal",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572683109999190128": {
|
||||||
|
"label": "guardian.netherite",
|
||||||
|
"lp_group": "guardian.netherite",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572682446665949344": {
|
||||||
|
"label": "guardian.emerald",
|
||||||
|
"lp_group": "guardian.emerald",
|
||||||
|
"weight": 80,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572681141528301588": {
|
||||||
|
"label": "guardian.diamond",
|
||||||
|
"lp_group": "guardian.diamond",
|
||||||
|
"weight": 85,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1572680750321369420": {
|
||||||
|
"label": "charcoal",
|
||||||
|
"lp_group": "charcoal",
|
||||||
|
"weight": 90,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873782303195160": {
|
||||||
|
"label": "detective.chest",
|
||||||
|
"lp_group": "detective.chest",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873793833337073": {
|
||||||
|
"label": "detective.ender_chest",
|
||||||
|
"lp_group": "detective.ender_chest",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873823444996116": {
|
||||||
|
"label": "detective.dropper",
|
||||||
|
"lp_group": "detective.dropper",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873835688173748": {
|
||||||
|
"label": "detective.barrel",
|
||||||
|
"lp_group": "detective.barrel",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873856269615235": {
|
||||||
|
"label": "detective.dispenser",
|
||||||
|
"lp_group": "detective.dispenser",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873864972795984": {
|
||||||
|
"label": "detective.hopper",
|
||||||
|
"lp_group": "detective.hopper",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"1574873872011104346": {
|
||||||
|
"label": "detective.shulker",
|
||||||
|
"lp_group": "detective.shulker",
|
||||||
|
"weight": 88,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"683346841265373195": {
|
||||||
|
"label": "founder",
|
||||||
|
"lp_group": "founder",
|
||||||
|
"weight": 100,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
403
config/permissions/domain_web.json
Normal file
403
config/permissions/domain_web.json
Normal file
|
|
@ -0,0 +1,403 @@
|
||||||
|
{
|
||||||
|
"tier_priority": [
|
||||||
|
"admin",
|
||||||
|
"guardian",
|
||||||
|
"charcoal",
|
||||||
|
"moderation",
|
||||||
|
"citizen",
|
||||||
|
"visitor"
|
||||||
|
],
|
||||||
|
"roles": {
|
||||||
|
"645629375060115466": {
|
||||||
|
"label": "citizen",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"650018103798923267": {
|
||||||
|
"label": "southern",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"880586135628288000": {
|
||||||
|
"label": "komrad",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"701395489916059648": {
|
||||||
|
"label": "internat",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"719994624839516202": {
|
||||||
|
"label": "eastern",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"975345120637501461": {
|
||||||
|
"label": "northern",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572742169926701109": {
|
||||||
|
"label": "western",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"645629751804952596": {
|
||||||
|
"label": "farmer",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572744082483187772": {
|
||||||
|
"label": "fighter",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"645629112991612938": {
|
||||||
|
"label": "miner",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"650019716563468320": {
|
||||||
|
"label": "builder",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"645629583957295105": {
|
||||||
|
"label": "scientist",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"645629213264838657": {
|
||||||
|
"label": "redstoner",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572746114396979240": {
|
||||||
|
"label": "clock.society",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"645628874964729878": {
|
||||||
|
"label": "writer",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [
|
||||||
|
"resin"
|
||||||
|
],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572742637230751784": {
|
||||||
|
"label": "candidat",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572746804766965862": {
|
||||||
|
"label": "gamemaster",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574757244971655228": {
|
||||||
|
"label": "skulk.warden",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572688957362409482": {
|
||||||
|
"label": "amethyst.shard",
|
||||||
|
"web_tier": "moderation",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572687861407555745": {
|
||||||
|
"label": "budding.amethyst",
|
||||||
|
"web_tier": "moderation",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574800386630357213": {
|
||||||
|
"label": "ministry.diamond",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574800809122603200": {
|
||||||
|
"label": "ministry.emerald",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574800893419724861": {
|
||||||
|
"label": "ministry.netherite",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574801051251646666": {
|
||||||
|
"label": "ministry.iron",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [
|
||||||
|
"iron"
|
||||||
|
],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574801143530528991": {
|
||||||
|
"label": "ministry.copper",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574801204184219678": {
|
||||||
|
"label": "ministry.lapis",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [
|
||||||
|
"lapis"
|
||||||
|
],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574801694221537310": {
|
||||||
|
"label": "ministry.redstone",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574801756817465477": {
|
||||||
|
"label": "ministry.gold",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574801933854712018": {
|
||||||
|
"label": "ministry.quartz",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1574802012954955828": {
|
||||||
|
"label": "ministry.resin",
|
||||||
|
"web_tier": "citizen",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": false
|
||||||
|
},
|
||||||
|
"1572684174895218818": {
|
||||||
|
"label": "guardian.amethyst",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"amethyst"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572687298682687538": {
|
||||||
|
"label": "guardian.resin",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"resin"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572686623743672363": {
|
||||||
|
"label": "guardian.quartz",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"quartz"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572685344153796749": {
|
||||||
|
"label": "guardian.gold",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"gold"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572686978980388894": {
|
||||||
|
"label": "guardian.redstone",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"redstone"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572684601111879730": {
|
||||||
|
"label": "guardian.lapis",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"lapis"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572685733733601321": {
|
||||||
|
"label": "guardian.copper",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"copper"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572686122721480734": {
|
||||||
|
"label": "guardian.iron",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"iron"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572683357815316500": {
|
||||||
|
"label": "guardian.coal",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"coal"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572683109999190128": {
|
||||||
|
"label": "guardian.netherite",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"netherite"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572682446665949344": {
|
||||||
|
"label": "guardian.emerald",
|
||||||
|
"web_tier": "guardian",
|
||||||
|
"ministries": [
|
||||||
|
[
|
||||||
|
"guardian",
|
||||||
|
"emerald"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572681141528301588": {
|
||||||
|
"label": "guardian.diamond",
|
||||||
|
"web_tier": "admin",
|
||||||
|
"ministries": [
|
||||||
|
"all",
|
||||||
|
"lapis",
|
||||||
|
"quartz",
|
||||||
|
"iron",
|
||||||
|
"diamond",
|
||||||
|
"emerald",
|
||||||
|
"netherite",
|
||||||
|
"redstone",
|
||||||
|
"copper",
|
||||||
|
"gold",
|
||||||
|
"resin"
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1572680750321369420": {
|
||||||
|
"label": "charcoal",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873782303195160": {
|
||||||
|
"label": "detective.chest",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873793833337073": {
|
||||||
|
"label": "detective.ender_chest",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873823444996116": {
|
||||||
|
"label": "detective.dropper",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873835688173748": {
|
||||||
|
"label": "detective.barrel",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873856269615235": {
|
||||||
|
"label": "detective.dispenser",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873864972795984": {
|
||||||
|
"label": "detective.hopper",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"1574873872011104346": {
|
||||||
|
"label": "detective.shulker",
|
||||||
|
"web_tier": "charcoal",
|
||||||
|
"ministries": [],
|
||||||
|
"audit_access": true
|
||||||
|
},
|
||||||
|
"683346841265373195": {
|
||||||
|
"label": "founder",
|
||||||
|
"web_tier": "admin",
|
||||||
|
"ministries": [
|
||||||
|
"all",
|
||||||
|
"lapis",
|
||||||
|
"quartz",
|
||||||
|
"iron",
|
||||||
|
"diamond",
|
||||||
|
"emerald",
|
||||||
|
"netherite",
|
||||||
|
"redstone",
|
||||||
|
"copper",
|
||||||
|
"gold",
|
||||||
|
"resin"
|
||||||
|
],
|
||||||
|
"audit_access": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,32 +1,10 @@
|
||||||
TIER_LEVELS = {
|
from core.permissions_bus import evaluate_web_access
|
||||||
"visitor": 0,
|
|
||||||
"citizen": 1,
|
|
||||||
"moderation": 2,
|
|
||||||
"charcoal": 3,
|
|
||||||
"guardian": 4,
|
|
||||||
"admin": 5
|
|
||||||
}
|
|
||||||
|
|
||||||
def compute_user_tier(role_ids: list, role_tiers_cfg: dict) -> str:
|
TIER_LEVELS = {"visitor": 0, "citizen": 1, "moderation": 2, "charcoal": 3, "guardian": 4, "admin": 5}
|
||||||
rset = {str(r) for r in role_ids}
|
|
||||||
if rset & set(role_tiers_cfg.get("admin", [])):
|
def evaluate_member_access(role_ids: list) -> dict:
|
||||||
return "admin"
|
return evaluate_web_access(role_ids)
|
||||||
if rset & set(role_tiers_cfg.get("guardian", [])):
|
|
||||||
return "guardian"
|
|
||||||
if rset & set(role_tiers_cfg.get("charcoal", [])):
|
|
||||||
return "charcoal"
|
|
||||||
if rset & set(role_tiers_cfg.get("moderation", [])):
|
|
||||||
return "moderation"
|
|
||||||
if rset & set(role_tiers_cfg.get("citizen", [])):
|
|
||||||
return "citizen"
|
|
||||||
return "visitor"
|
|
||||||
|
|
||||||
def filter_tools_for_tier(tools: list, user_tier: str) -> list:
|
def filter_tools_for_tier(tools: list, user_tier: str) -> list:
|
||||||
user_lvl = TIER_LEVELS.get(user_tier, 0)
|
user_lvl = TIER_LEVELS.get(user_tier, 0)
|
||||||
enriched = []
|
return [{**t, "unlocked": user_lvl >= TIER_LEVELS.get(t.get("min_tier", "visitor"), 0)} for t in tools]
|
||||||
for t in tools:
|
|
||||||
req_lvl = TIER_LEVELS.get(t.get("min_tier", "visitor"), 0)
|
|
||||||
item = dict(t)
|
|
||||||
item["unlocked"] = user_lvl >= req_lvl
|
|
||||||
enriched.append(item)
|
|
||||||
return enriched
|
|
||||||
|
|
|
||||||
96
core/permissions_bus.py
Normal file
96
core/permissions_bus.py
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
import os, json
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
PERM_DIR = "/var/www/flexicraft-site/config/permissions"
|
||||||
|
AUDIT_LOG = "/var/www/flexicraft-site/data/permissions_audit.log"
|
||||||
|
PROTECTED_GROUPS = {"founder", "guardian.diamond", "guardian.netherite"}
|
||||||
|
COUNTERPOWER_GROUPS = {"charcoal", "detective"}
|
||||||
|
|
||||||
|
def _read_domain(name: str) -> dict:
|
||||||
|
p = os.path.join(PERM_DIR, f"domain_{name}.json")
|
||||||
|
if os.path.exists(p):
|
||||||
|
with open(p, "r", encoding="utf-8") as f:
|
||||||
|
return json.load(f)
|
||||||
|
return {"roles": {}}
|
||||||
|
|
||||||
|
def _write_domain(name: str, data: dict):
|
||||||
|
p = os.path.join(PERM_DIR, f"domain_{name}.json")
|
||||||
|
tmp = p + ".tmp"
|
||||||
|
with open(tmp, "w", encoding="utf-8") as f:
|
||||||
|
json.dump(data, f, indent=2, ensure_ascii=False)
|
||||||
|
os.replace(tmp, p)
|
||||||
|
|
||||||
|
def log_permission_change(actor: str, domain: str, role_id: str, changes: dict):
|
||||||
|
os.makedirs(os.path.dirname(AUDIT_LOG), exist_ok=True)
|
||||||
|
entry = {"ts": datetime.now(timezone.utc).isoformat(), "actor": actor, "domain": domain, "role_id": role_id, "changes": changes}
|
||||||
|
with open(AUDIT_LOG, "a", encoding="utf-8") as f:
|
||||||
|
f.write(json.dumps(entry, ensure_ascii=False) + "\n")
|
||||||
|
|
||||||
|
def evaluate_web_access(role_ids: list) -> dict:
|
||||||
|
dom = _read_domain("web")
|
||||||
|
roles_cfg = dom.get("roles", {})
|
||||||
|
matched = [roles_cfg[str(r)] for r in role_ids if str(r) in roles_cfg]
|
||||||
|
|
||||||
|
tier = "visitor"
|
||||||
|
for candidate in dom.get("tier_priority", ["admin", "guardian", "charcoal", "moderation", "citizen", "visitor"]):
|
||||||
|
if any(m.get("web_tier") == candidate for m in matched):
|
||||||
|
tier = candidate
|
||||||
|
break
|
||||||
|
|
||||||
|
ministries = set()
|
||||||
|
for m in matched:
|
||||||
|
ministries.update(m.get("ministries", []))
|
||||||
|
|
||||||
|
has_all = "all" in ministries
|
||||||
|
return {
|
||||||
|
"tier": tier,
|
||||||
|
"ministries": sorted(ministries),
|
||||||
|
"audit_access": any(m.get("audit_access", False) for m in matched),
|
||||||
|
"lapis": has_all or ("lapis" in ministries),
|
||||||
|
"quartz": has_all or ("quartz" in ministries),
|
||||||
|
"iron": has_all or ("iron" in ministries),
|
||||||
|
"netherite": has_all or ("netherite" in ministries),
|
||||||
|
"admin": has_all or (tier == "admin")
|
||||||
|
}
|
||||||
|
|
||||||
|
def resolve_forgejo_team(role_ids: list) -> str:
|
||||||
|
dom = _read_domain("forgejo")
|
||||||
|
roles_cfg = dom.get("roles", {})
|
||||||
|
member_teams = {roles_cfg[str(r)]["forgejo_team"] for r in role_ids if str(r) in roles_cfg}
|
||||||
|
for team_name in dom.get("team_priority", ["guardian", "iron", "lapis", "citizen"]):
|
||||||
|
if team_name in member_teams:
|
||||||
|
return team_name
|
||||||
|
return "citizen"
|
||||||
|
|
||||||
|
def update_role_domain_guarded(actor_name: str, is_supreme_admin: bool, domain: str, role_id: str, new_values: dict) -> dict:
|
||||||
|
"""
|
||||||
|
Applique une modification de permission (panel Netherite) avec garde-fous constitutionnels.
|
||||||
|
"""
|
||||||
|
if domain not in ("minecraft", "forgejo", "web"):
|
||||||
|
return {"ok": False, "error": "Domaine invalide"}
|
||||||
|
|
||||||
|
mc_dom = _read_domain("minecraft")
|
||||||
|
target_lp = mc_dom.get("roles", {}).get(str(role_id), {}).get("lp_group", "")
|
||||||
|
|
||||||
|
# Garde-fou 1 : Netherite ne peut pas modifier Founder, Diamond ni lui-meme
|
||||||
|
if not is_supreme_admin and target_lp in PROTECTED_GROUPS:
|
||||||
|
return {"ok": False, "error": f"Verrou constitutionnel : impossible de modifier le rang protege '{target_lp}'."}
|
||||||
|
|
||||||
|
# Garde-fou 2 : Protection du contre-pouvoir Charcoal / Detectives
|
||||||
|
if not is_supreme_admin and any(k in target_lp for k in COUNTERPOWER_GROUPS):
|
||||||
|
if domain == "web" and new_values.get("audit_access") is False:
|
||||||
|
return {"ok": False, "error": "Verrou constitutionnel : impossible de retirer l'acces Audit au contre-pouvoir."}
|
||||||
|
|
||||||
|
dom_data = _read_domain(domain)
|
||||||
|
if str(role_id) not in dom_data.get("roles", {}):
|
||||||
|
return {"ok": False, "error": "Role Discord introuvable dans ce domaine"}
|
||||||
|
|
||||||
|
# Bloquer toute auto-elevation vers admin/all par Netherite
|
||||||
|
if not is_supreme_admin and domain == "web":
|
||||||
|
if new_values.get("web_tier") == "admin" or "all" in new_values.get("ministries", []):
|
||||||
|
return {"ok": False, "error": "Verrou constitutionnel : elevation vers 'admin' ou 'all' interdite."}
|
||||||
|
|
||||||
|
dom_data["roles"][str(role_id)].update(new_values)
|
||||||
|
_write_domain(domain, dom_data)
|
||||||
|
log_permission_change(actor_name, domain, str(role_id), new_values)
|
||||||
|
return {"ok": True, "role": dom_data["roles"][str(role_id)]}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue