mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-04 05:15:39 +00:00 
			
		
		
		
	Add LDAP stuff to user model.
This commit is contained in:
		
							
								
								
									
										74
									
								
								app/User.php
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								app/User.php
									
									
									
									
									
								
							@@ -140,6 +140,14 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 | 
			
		||||
 * @property-read int|null $object_groups_count
 | 
			
		||||
 * @property-read \Illuminate\Database\Eloquent\Collection|Webhook[] $webhooks
 | 
			
		||||
 * @property-read int|null $webhooks_count
 | 
			
		||||
 * @property string|null $two_factor_secret
 | 
			
		||||
 * @property string|null $two_factor_recovery_codes
 | 
			
		||||
 * @property string|null $guid
 | 
			
		||||
 * @property string|null $domain
 | 
			
		||||
 * @method static Builder|User whereDomain($value)
 | 
			
		||||
 * @method static Builder|User whereGuid($value)
 | 
			
		||||
 * @method static Builder|User whereTwoFactorRecoveryCodes($value)
 | 
			
		||||
 * @method static Builder|User whereTwoFactorSecret($value)
 | 
			
		||||
 */
 | 
			
		||||
class User extends Authenticatable
 | 
			
		||||
{
 | 
			
		||||
@@ -439,4 +447,70 @@ class User extends Authenticatable
 | 
			
		||||
    {
 | 
			
		||||
        return $this->hasManyThrough(Transaction::class, TransactionJournal::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // start LDAP related code
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the database column name of the domain.
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getLdapDomainColumn()
 | 
			
		||||
    {
 | 
			
		||||
        return 'domain';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the models LDAP domain.
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getLdapDomain()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->{$this->getLdapDomainColumn()};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the models LDAP domain.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $domain
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function setLdapDomain($domain)
 | 
			
		||||
    {
 | 
			
		||||
        $this->{$this->getLdapDomainColumn()} = $domain;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the models LDAP GUID database column name.
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getLdapGuidColumn()
 | 
			
		||||
    {
 | 
			
		||||
        return 'objectguid';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the models LDAP GUID.
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getLdapGuid()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->{$this->getLdapGuidColumn()};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the models LDAP GUID.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $guid
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function setLdapGuid($guid)
 | 
			
		||||
    {
 | 
			
		||||
        $this->{$this->getLdapGuidColumn()} = $guid;
 | 
			
		||||
    }
 | 
			
		||||
    // end LDAP related code
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user