Solstice::LoginRealm - Represents a person login realm.


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::LoginRealm - Represents a person login realm.

SYNOPSIS

Top

DESCRIPTION

Top

This object exists as a superclass for specific person login realm objects

Export

No symbols exported.

Methods

new([\%input])
getSystemDataForLogin($login_name)
getSystemDataForLogins(\@login_names)
setPersonDataOnLogin($person)

If applicable, a login realm can set information, such as system name or email, on login. This is mainly useful for login realms that pull values from ENV.

isValidLogin($login_name)

Returns TRUE by default. This method can be subclassed to provide a set of criteria used to allow logins access to solstice applications.

isValidAccountName($login_name)

Returns TRUE by default. This method can be subclassed if there are login_name patterns that are simply invalid.

getEmailAddress($login_name)

Returns a version of the username as an email address. Must be implemented in a subclass.

getScopedLoginName($login_name)

Returns the login name, scoped to the login realm. Can be subclassed to return something other than the passed $login_name.

isActiveLogin($time)

Decides if the current login is active, based on the time. If this returns FALSE, the user will be forced to reauthenticate. Defaults to never timing out a login.

Private Methods

_initFromHash(\%data)
getRemoteGroupControllerPackage() =cut
_getAccessorDefinition()

AUTHOR

Top

Catalyst Group, <catalyst@u.washington.edu>

VERSION

Top

$ Revision: $

COPYRIGHT

Top


Solstice documentation Contained in the Solstice distribution.
package Solstice::LoginRealm;

use 5.006_000;
use strict;
use warnings;

use base qw(Solstice::Model);

use constant TRUE  => 1;
use constant FALSE => 0;

our ($VERSION) = ('$Revision: 2253 $' =~ /^\$Revision:\s*([\d.]*)/);

sub new {
    my $obj = shift;
    my $input = shift;

    my $self = $obj->SUPER::new();
    
    if (defined $input && $self->_isValidHashRef($input)) {
        return undef unless $self->_initFromHash($input);
    } else {
        $input = 'undef' unless defined $input; # Just for the msg.
        die ((ref $self). ": Improper argument passed to new(): $input\n");
    }
    
    return $self;
}

sub getSystemDataForLogin {
    my $self = shift;
    my $login_name = shift;

    my $hash_ref = $self->getSystemDataForLogins([$login_name]);
    return $hash_ref->{$login_name} || {};
}

sub getSystemDataForLogins {
    warn "getSystemDataForLogins(): Not implemented";
    return {};
}

sub setPersonDataOnLogin {
    return;
}

sub isValidLogin {
    return TRUE;
}

sub isValidAccountName {
    return TRUE;
}

sub getEmailAddress {
    return;
}

sub getScopedLoginName {
    return $_[1];
}

sub isActiveLogin {
    return TRUE;
}

sub _initFromHash {
    my $self = shift;
    my $data = shift;

    return FALSE unless defined $data->{'login_realm_id'};

    unless (defined $data->{'package'} and ($data->{'package'} eq $self->getClassName())) {
        warn 'Incorrect package name: '.$data->{'package'};
        return FALSE;
    }

    $self->_setID($data->{'login_realm_id'});
    $self->_setName($data->{'name'});
    $self->_setDescription($data->{'description'});
    $self->_setDisplayName($data->{'display_name'});
    $self->_setContactName($data->{'contact_name'});
    $self->_setContactEmail($data->{'contact_email'});
    $self->_setScope($data->{'scope'});
    
    return TRUE;
}

sub getRemoteGroupControllerPackage {
    return;
}

sub _getAccessorDefinition {
    return [
        {
            name => 'Name',
            key  => '_name',
            type => 'String',
            private_set => TRUE,
        },
        {
            name => 'Description',
            key  => '_description',
            type => 'String',
            private_set => TRUE,
        },
        {
            name => 'DisplayName',
            key  => '_display_name',
            type => 'String',
            private_set => TRUE,
        },
        {
            name => 'ContactName',
            key  => '_contact_name',
            type => 'String',
            private_set => TRUE,
        },
        {
            name => 'ContactEmail',
            key  => '_contact_email',
            type => 'String',
            private_set => TRUE,
        },
        {
            name => 'Scope',
            key  => '_scope',
            type => 'String',
            private_set => TRUE,
        },
    ];
}


1;

__END__