通过createTimestamp为PUMA搜索用户提供REST服务

时间:2016-08-02 13:37:19

标签: rest websphere websphere-portal

是否可以通过REST服务上的createTimestamp属性为PUMA查找用户?搜索其他属性效果很好,但如果type属性是dateTime,我会得到不同的错误,例如http://www-01.ibm.com/support/docview.wss?uid=swg1PM54864

我需要找到早些时候创建的用户。

我试过了:

function add_css_to_head(){
    $buffer =  get_option( 'get_css_head' );

    $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
    $buffer = str_replace(': ', ':', $buffer);
    $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
    echo($buffer);

}
add_action('wp_head', 'add_css_to_head');

甚至平等都不起作用

host/wps/um/secure/users/profiles?searchAttributes=createTimestamp>=yyyyMMddHHmmssZ

host/wps/um/secure/users/profiles?searchAttributes=createTimestamp>=yyyy-MM-dd'T'HH:mm:ss

host/wps/um/secure/users/profiles?searchAttributes=createTimestamp>=yyyy-MM-dd'T'HH:mm:ss'Z'

1 个答案:

答案 0 :(得分:0)

我通过ldap解决了这个问题。

@Service
public class LdapService {

    @Autowired
    private LdapTemplate ldapTemplate;

    private SearchControls searchControls;

    @PostConstruct
       private void init() {
       searchControls = new SearchControls();
       searchControls.setCountLimit(10000);
       searchControls.setSearchScope(SUBTREE_SCOPE);
    }

    private class MemberMapper implements ContextMapper {

        public Member mapFromContext(Object ctx) {
            Member member = new Member();
            DirContextAdapter adapter = (DirContextAdapter) ctx;
            Attribute valueMail = adapter.getAttributes().get("mail");
            try {
                member.setEmail(valueMail == null ? null : valueMail.get().toString().trim());
            } catch (Exception ignore) {
            }

            Attribute valueCN = adapter.getAttributes().get("cn");
            try {
                member.setLogin(valueCN == null ? null : valueCN.get().toString().trim());
            } catch (Exception ignore) {
            }
            return member;
        }
    }

    public List<Member> getUsersByCreateTimestamp() {
        AndFilter andFilter = new AndFilter();
        andFilter.and(new GreaterThanOrEqualsFilter("createTimestamp" "20160803000000"));
        andFilter.and(new LessThanOrEqualsFilter("createTimestamp", "20160804000000"));

        List<Member> allMembers = new ArrayList<Member>();
        List<Member> members = ldapTemplate.search("", andFilter.encode(), searchControls, new MemberMapper());
        allMembers.addAll(members);
        return allMembers;
    }