EN · DE · RU · FR · ES

#131: IHKPluginUserRightId.kt

plugins/org.projectforge.plugins.ihk/src/main/kotlin/org/projectforge/plugins/ihk/IHKPluginUserRightId.kt Kotlin enum / user right identifier, plugins/org.projectforge.plugins.ihk/src/main/kotlin/org/projectforge/plugins/ihk/IHKPluginUserRightId.kt 60 lines · 24 code · 30 comments · 6 blank
Kotlin enum implementing IUserRightId to define the IHK plugin's single access right. Provides a ProviderService inner class for Hibernate Search indexing and the right-right provider SPI.

Architecture

Enum Definition

@Indexed
@TypeBinding(binder = TypeBinderRef(type = HibernateSearchUserRightIdTypeBinder::class))
enum class IHKPluginUserRightId(
    override val id: String,
    override val orderString: String,
    override val i18nKey: String
) : IUserRightId {
    IHK("PLUGIN_IHK", "plugin70", "plugins.ihk");
}
ParameterValueMeaning
id"PLUGIN_IHK"Unique identifier across all plugins; stored in the database for user-right assignments
orderString"plugin70"Sort key for the UserEditPage rights table; pluginnn pattern ensures plugins sort after built-in rights
i18nKey"plugins.ihk"Key for the right's display name in the UI; resolved via IHKI18nResources.properties

Hibernate Search Integration

The @Indexed and @TypeBinding annotations bind this enum to HibernateSearchUserRightIdTypeBinder, enabling full-text search across user-right assignments. When a Hibernate Search query scans PFUserDO entities for rights, this type binder knows how to index enum-based right IDs.

ProviderService (SPI)

The inner class ProviderService implements RightRightIdProviderService, a Java SPI interface. Its getUserRightIds() method returns the enum entries via Arrays.asList(*entries.toTypedArray()). This is loaded by the ServiceLoader and contributes the IHK right to the global registry of all known user rights in the system.

class ProviderService : RightRightIdProviderService {
    override fun getUserRightIds(): Collection<IUserRightId> {
        return Arrays.asList<IUserRightId>(*entries.toTypedArray())
    }
}

Design Decisions

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
067a4cbb1 Migration stuff in progress...
b1560ca43 Migration stuff in progress...