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

cn.home1.oss.lib.security.api.StaticPrivilege Maven / Gradle / Ivy

There is a newer version: 1.0.8.OSS
Show newest version
package cn.home1.oss.lib.security.api;

import cn.home1.oss.lib.common.DiscoverableEnum;

import org.springframework.security.core.GrantedAuthority;

/**
 * User should define enum which implements this interface.
 * Created by zhanghaolun on 16/7/14.
 */
public interface StaticPrivilege & StaticPrivilege>
    extends DiscoverableEnum, GrantedAuthority {

  String PRIVILEGE_PREFIX = "PRIVILEGE_";

  static String toAuthority(final String resource, final String action) {
    return PRIVILEGE_PREFIX + resource + "_" + action;
  }

  String getAction();

  @Override
  default String getAuthority() {
    return toAuthority(getResource(), getAction());
  }

  String getResource();

  @Override
  default String getText() {
    return this.getAuthority();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy