All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.data.plugin.model.PluginPermissionConfig Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.data.plugin.model;

import static java.util.Objects.requireNonNull;

import javax.annotation.PostConstruct;
import org.molgenis.security.core.PermissionRegistry;
import org.molgenis.security.core.PermissionSet;
import org.molgenis.util.i18n.PropertiesMessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PluginPermissionConfig {
  private final PermissionRegistry permissionRegistry;

  public PluginPermissionConfig(PermissionRegistry permissionRegistry) {
    this.permissionRegistry = requireNonNull(permissionRegistry);
  }

  @PostConstruct
  public void registerPermissions() {
    permissionRegistry.addMapping(PluginPermission.VIEW_PLUGIN, PermissionSet.READ);
  }

  @Bean
  public PropertiesMessageSource dataPluginMessageSource() {
    return new PropertiesMessageSource("data-plugin");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy