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

com.jahnelgroup.jackson.security.policy.CreatedByFieldSecurityPolicy.kt Maven / Gradle / Ivy

package com.jahnelgroup.jackson.security.policy

import com.fasterxml.jackson.databind.ser.PropertyWriter
import org.springframework.context.ApplicationContext

/**
 * CreatedByFieldSecurityPolicy
 */
class CreatedByFieldSecurityPolicy : FieldSecurityPolicy {

    override fun permitAccess(writer: PropertyWriter, target: Any, targetCreatedByUser: String?, currentPrincipalUser: String?): Boolean =
            targetCreatedByUser == currentPrincipalUser

    override fun setApplicationContext(applicationContext: ApplicationContext) {
        // not required
        applicationContext.getBean("userRepository")

        var one : List = ArrayList()
        var two : List = ArrayList()

        one.stream().anyMatch(two::contains)
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy