xyz.erupt.upms.looker.LookerSelf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of erupt-upms Show documentation
Show all versions of erupt-upms Show documentation
User Permissions Management
The newest version!
package xyz.erupt.upms.looker;
import org.springframework.stereotype.Component;
import xyz.erupt.annotation.PreDataProxy;
import xyz.erupt.annotation.fun.DataProxy;
import xyz.erupt.annotation.query.Condition;
import xyz.erupt.core.context.MetaContext;
import xyz.erupt.upms.helper.HyperModelCreatorVo;
import xyz.erupt.upms.service.EruptUserService;
import javax.annotation.Resource;
import javax.persistence.MappedSuperclass;
import java.util.List;
/**
* @author YuePeng
* date 2021/3/10 11:30
*/
@MappedSuperclass
@PreDataProxy(LookerSelf.Comp.class)
public class LookerSelf extends HyperModelCreatorVo implements DataProxy {
@Component
static class Comp implements DataProxy {
@Resource
private EruptUserService eruptUserService;
@Override
public String beforeFetch(List conditions) {
if (eruptUserService.getCurrentEruptUser().getIsAdmin()) return null;
return MetaContext.getErupt().getName() + ".createUser.id = " + eruptUserService.getCurrentUid();
}
}
}