Is there a way to restrict usage of typeclass to specific permission? #3827
-
|
I want to make certain typeclasses only available to certain users. At the moment, if you give someone 'Builder' permissions, they have access to all typeclasses. Is there a (common) way to restrict the usage of specific typeclasses only to users with specific permissions? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 6 replies
-
|
Yes. Check out locks and perms in the documentation! |
Beta Was this translation helpful? Give feedback.
-
|
@jaborsh Thanks for your quick answer. I've read the documentation for Locks and Permissions, but it seems, all these locks and permissions only apply to instantiated If I give 'Builder' permissions to an account it has access to all typeclasses in Evennia, so it can create any object form every typeclass available in Evennia execpt Accounts. And I want to restrict the usage of the typeclasses itself and not the instantiated objects from a typeclass. So that an object of typeclass Maybe I'm misunderstanding something, but I've searched everywhere to get a solution to this problem, but it seems no one has this problem, so it may be really trivial and I don't get it, or it is not possible. |
Beta Was this translation helpful? Give feedback.
-
|
The short answer: not with just the built-in tools. The long answer: Evennia allows you to extend, replace, or remove just about any feature it comes with, including its build tools. So, while this isn't possible straight out of the box, it's entirely possible to create your own permissions layer on builder tools defining what typeclasses a given perm level allows you to create. That said, I think it would be worthwhile to think about why you need this feature, as just on the surface it sounds like you might be trying to do too much with the concept of typeclasses if it's a problem for someone with object-creation powers to create an implemented type of object. Your GuestBook typeclass, for example: what is the danger of someone making one? Why are those dangerous things baked into the object itself? Things like that. |
Beta Was this translation helpful? Give feedback.
-
|
@InspectorCaracal Yes, I've already guessed, that it's not easily possible. I think I have to build this feature somehow myself.
Because you thought about why I need this feature: I want this function, because I want to create a MUD/MUSH to be an environment mainly build by its users while also staying in control. World building should be done via ingame commands like `spawn`, `create` and `dig` by the users, and actual code commits sould be send as pull requests or with `git send-email` so it should be possible to make typeclasses by the users if they want.
I want to be able to use different permissions for some typeclasses, so that a 'Beginner' Builder can't use every typeclass. I hope that as many users as possible become builders, but with different permissions like 'Beginner', 'Advanced' and 'Expert' for example (not sure about that yet). It depends on the level of trust I have in these users.
And the `Guestbook` for example holds Objects of typeclass `GuestbookEntry` and it shouldn't be possible to create those other than signing the `Guestbook` which handles them (except for 'Developers', which is a permission I won't give to users).
I need to think about that. Best would be I could simply attach a kind of lock to a typeclass instead of maintaining a list of typeclasses every permission can use. Seems to be a bigger project. If you have any advice I would be happy to read about it.
Thanks for your answer.
|
Beta Was this translation helpful? Give feedback.
-
|
A custom `create` function seems to be a good solution. But the 'create_object()' function seems to be deeply hidden in the evennia code. I already searched for it (was hard to find). It's in the `objects/manager.py` file in the `ObjectDBManager()` class in the Evennia code.
How do I change that class without altering the original evennia codebase? Is this even possible?
|
Beta Was this translation helpful? Give feedback.
-
|
Yes, but you can specify the a typeclass in the `spawn` command when spawning an object. So changing the `create_object()` function seems to be a better solution, I believe.
|
Beta Was this translation helpful? Give feedback.
-
|
I think you are right. Best, I'll simply rewrite the build commands. Better than messing with the Evennia code itself, which I really don't want.
Your help is very appreciated! Thanks alot!
|
Beta Was this translation helpful? Give feedback.
The short answer: not with just the built-in tools.
The long answer:
Evennia allows you to extend, replace, or remove just about any feature it comes with, including its build tools. So, while this isn't possible straight out of the box, it's entirely possible to create your own permissions layer on builder tools defining what typeclasses a given perm level allows you to create.
That said, I think it would be worthwhile to think about why you need this feature, as just on the surface it sounds like you might be trying to do too much with the concept of typeclasses if it's a problem for someone with object-creation powers to create an implemented type of object. Your GuestBook typeclass, f…