Package org.openhab.core.voice.security
Interface ItemPermissionResolver
@NonNullByDefault
public interface ItemPermissionResolver
Defines a utility service to resolve the permission for an item for Human Language Interpreters.
The permission rules are as follows:
- Explicit configuration: An Item can explicitly set the permission via the
permissionproperty in thevoiceSystemmetadata namespace. - Inheritance: If no explicit configuration is found on the Item itself, it inherits permissions from its parent groups.
- Merging and Priority: Parent permissions are merged. Within the same layer, the following prioritization applies:
ItemPermission.NO_ACCESS>ItemPermission.READ_ONLY>ItemPermission.READ_WRITE. The closest parent layer has priority over further away layers. - System Default: If no explicit configuration is found on the Item or any of its ancestors, the system-wide default is used.
- Author:
- Florian Hotze - Initial contribution
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItemAccessChangeListener(Runnable listener) Adds a listener that is notified whenever item access may have changed.getItemPermissionDetails(Item item) Gets theItemPermissionResolver.ItemPermissionDetailsfor an item.getPermission(Item item) Returns theItemPermissionfor an item.default booleanisAccessible(Item item) Returns whether an item is accessible forHumanLanguageInterpreters.voidremoveItemAccessChangeListener(Runnable listener) Removes a previously registered item access change listener.
-
Field Details
-
VOICE_SYSTEM_NAMESPACE
- See Also:
-
PERMISSION_PROPERTY
- See Also:
-
SYSTEM_DEFAULT_SOURCE
- See Also:
-
-
Method Details
-
addItemAccessChangeListener
Adds a listener that is notified whenever item access may have changed.- Parameters:
listener- the listener to add
-
removeItemAccessChangeListener
Removes a previously registered item access change listener.- Parameters:
listener- the listener to remove
-
getPermission
Returns theItemPermissionfor an item.- Parameters:
item- the item to check- Returns:
- the item permission
-
isAccessible
Returns whether an item is accessible forHumanLanguageInterpreters.- Parameters:
item- the item to check- Returns:
- true if the item is accessible, false otherwise
-
getItemPermissionDetails
Gets theItemPermissionResolver.ItemPermissionDetailsfor an item.- Parameters:
item- the item to check- Returns:
- the item permission details (the item permission and its source)
-