package com.springboot.cloud.auth.authentication.service;

import com.springboot.cloud.auth.authentication.entity.Popedom;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public interface PopedomService {

    /**
     * 动态新增更新权限
     *
     * @param popedoms
     */
    void savePopedom(List<Popedom> popedoms);

    /**
     * 动态删除权限
     *
     * @param popedom
     */
    void removePopedom(Popedom popedom);

    /**
     * 加载权限资源数据
     */
    void loadPopedom();

    /**
     * 根据url和method查询到对应的权限信息
     *
     * @param authRequest
     * @return
     */
    List<ConfigAttribute> findConfigAttributesByUrl(HttpServletRequest authRequest);

    /**
     * 根据用户名查询 该用户所拥有的角色对应的资源信息
     * @param companyId
     * @param username
     * @return
     */
    List<Popedom> queryByUsername(String companyId,String username);

    /**
     * 资源对应的应用是否过期
     */
    boolean license(String companyId, String applicationCode);
}
