Author Topic: New Permission System Design  (Read 2926 times)

De-Legro

  • M&F Dev Team
  • Sr. Member
  • *****
  • Posts: 3109
  • Karma: +105/-54
    • View Profile
Re: New Permission System Design
« Reply #30 on: October 13, 2017, 07:54:03 AM »
Well that's why I was thinking a hidden list would simplify things.

- Make the list automatically for new accounts. This should only happen in one place in the code.
- When you create a new character, add them to the list
- when a character dies, delete them from the list
- when you gain control of a settlement, add in permissions for the list

basically this only needs to add code in where things change, not all places that might check permissions. It piggy-backs on already-existing and known working code. it's always better to layer a new system on existing systems than to write special exceptions. Much easier to debug.

But you ignore the question I keep raising. Do you WANT all your character having a single permission list automatically applied to them? Do you want all your settlements to be bound to this list? For example most of my own personal characters have no access to Hawks Hold, indeed very few characters do since there is some RP revolving around it religious significance to Hawks.
He who was once known as Blackfyre

Cipheron

  • Full Member
  • ***
  • Posts: 186
  • Karma: +7/-4
    • View Profile
Re: New Permission System Design
« Reply #31 on: October 13, 2017, 08:35:03 AM »
Well since you control the characters, you're free to ignore that to your heart's content. No-one would make you go and use those towns. If denying access is RP-only then you'd have to explain why you need the rules to default to supporting things the way you want, for every player.

Because you want to RP your own characters not having access to a certain town is no good reason to make it the default that nobody's characters have default access to any of their other towns. you can RP not having access all you want even if access exists. However people can't RP having access when no access exists. It only becomes an issue when people try to access towns that their other characters own. Then they have to go through additional steps of logging out of one character, logging into the other character, editing permissions, then logging back into the original character. So in other words, the only time it impacts gameplay is as a random timewasting hassle when they're trying to do something. If they didn't want the character having that access, then they wouldn't try and access it.

Andrew outlined the solution anyway, if you want to restrict your character's access artificially. That is, to have a new checkbox on the permissions screen saying "allow same player's character access". Then when you click it, it uses the existing list system behind the scenes (to keep the code changes to a minimum). I'd recommend that it defaults to "on" however. Then you'd be free to click it "off" if that supports your roleplaying scenario how you like. But of course the checkbox would be a little redundant here since you can just pretend.
« Last Edit: October 13, 2017, 09:00:28 AM by Cipheron »

Andrew

  • Game Master / Lead Developer
  • Administrator
  • Sr. Member
  • *****
  • Posts: 1797
  • Karma: +75/-7
  • Mildly Amused
    • View Profile
    • Lemuria Community Fan Site
Re: New Permission System Design
« Reply #32 on: October 13, 2017, 01:30:49 PM »
I'd not even make that setting use the existing lists system. It'd be far simpler to jsut have the game do something like "if (in_array($settlement->getLord()->getUser()->getCharacters(), $currentcharacter) { allow } else { deny }". If I'm understanding the code right, I think that logic would be part of this function: https://github.com/Zanaras/MaFCDR/blob/master/src/BM2/SiteBundle/Service/PermissionManager.php#L52, along with an update to the form used to select settlement permissions to allow that as an option. We would possibly also want to make that a user profile selectable, so there could be a default setting for players to have when taking over a settlement.

Someone mentioned somewhere to allow RealmPositions to be on lists, technically, they already can be. It's just not fully implemented. I THINK all that we'd need to do is expose the field on the form, build a search method for it (by stealing the one used for realms, settlements, or characters and modifying accordingly), then edit this line here: https://github.com/Zanaras/MaFCDR/blob/master/src/BM2/SiteBundle/Service/PermissionManager.php#L121, to include a check for $member->getTargetRealmPosition and whatever logic is needed--it shouldn't differ too much from the character one, just with an additional step to fetch the position holders and see if the character we're looking at is one of them. The database itself already supports this logic, and has since the server move--that is, the field in the database for positions exists on permission list members and has a relation setup to the ream positions. I do sometimes do small updates knowing what I want to do to an area later.
Standing for the creation of interesting things since Year 1, Week 5, Day 4.
Favorite cold beverage: Strawberry Shake
My hobbies: Fixing computers, video games, anime, manga, some other stuff, sleep (in no particular order)