Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 920 → Rev 921

/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/Mailbox.java
1,6 → 1,8
package ak.hostcaptain.core.model;
 
import ak.hostcaptain.util.Digest;
import ak.hostcaptain.util.ModelException;
import ak.hostcaptain.util.ModelSecurityException;
 
/**
*
31,7 → 33,7
return id;
}
 
public void setId(Long id)
protected void setId(Long id)
{
this.id = id;
}
45,26 → 47,36
return login;
}
 
public void setLogin(String login)
protected void setLogin(String login)
{
this.login = login;
}
 
public void setLogin(User editor, String login)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.login = login;
}
 
/**
*
* @hibernate.property
*/
public String getPassword()
protected String getPassword()
{
return password;
}
 
public void setPassword(String password)
protected void setPassword(String password)
{
this.password = password;
}
 
public void setNewPassword(String password)
public void setPassword(User editor, String password)
throws ModelException
{
if(password == null)
throw new NullPointerException("Null password");
81,11 → 93,20
return domain;
}
 
public void setDomain(InetDomain domain)
protected void setDomain(InetDomain domain)
{
this.domain = domain;
}
 
public void setDomain(User editor, InetDomain domain)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.domain = domain;
}
 
/**
*
* @hibernate.many-to-one
95,11 → 116,20
return owner;
}
 
public void setOwner(User owner)
protected void setOwner(User owner)
{
this.owner = owner;
}
 
public void setOwner(User editor, User owner)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.owner = owner;
}
 
/**
*
* @hibernate.property
109,11 → 139,20
return virusCheck;
}
 
public void setVirusCheck(Boolean virusCheck)
protected void setVirusCheck(Boolean virusCheck)
{
this.virusCheck = virusCheck;
}
 
public void setVirusCheck(User editor, Boolean virusCheck)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.virusCheck = virusCheck;
}
 
/**
*
* @hibernate.property
123,11 → 162,20
return spamCheck;
}
 
public void setSpamCheck(Boolean spamCheck)
protected void setSpamCheck(Boolean spamCheck)
{
this.spamCheck = spamCheck;
}
 
public void setSpamCheck(User editor, Boolean spamCheck)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.spamCheck = spamCheck;
}
 
/**
*
* @hibernate.many-to-one
137,11 → 185,20
return systemUser;
}
 
public void setSystemUser(SystemUser systemUser)
protected void setSystemUser(SystemUser systemUser)
{
this.systemUser = systemUser;
}
 
public void setSystemUser(User editor, SystemUser systemUser)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.systemUser = systemUser;
}
 
public String getTypeKey()
{
return ak.hostcaptain.core.CoreResources.TYPE_MAILBOX;
171,4 → 228,12
{
return user.isSuperuser() || user.equals(domain.getOwner());
}
 
protected static boolean allowedToCreate(MailboxManager manager, User editor)
throws ModelException
{
return editor.isSuperuser()
|| InetDomainManager.getInstance().areInetDomainsAvailable(editor);
}
}
 
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/MailAlias.java
1,6 → 1,8
package ak.hostcaptain.core.model;
 
import java.util.Collection;
import ak.hostcaptain.util.ModelException;
import ak.hostcaptain.util.ModelSecurityException;
 
/**
*
28,7 → 30,7
return id;
}
 
public void setId(Long id)
protected void setId(Long id)
{
this.id = id;
}
42,11 → 44,20
return address;
}
 
public void setAddress(String address)
protected void setAddress(String address)
{
this.address = address;
}
 
public void setAddress(User editor, String address)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.address = address;
}
 
/**
*
* @hibernate.many-to-one
56,11 → 67,20
return domain;
}
 
public void setDomain(InetDomain domain)
protected void setDomain(InetDomain domain)
{
this.domain = domain;
}
 
public void setDomain(User editor, InetDomain domain)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.domain = domain;
}
 
/**
*
* @hibernate.many-to-one
70,11 → 90,20
return owner;
}
 
public void setOwner(User owner)
protected void setOwner(User owner)
{
this.owner = owner;
}
 
public void setOwner(User editor, User owner)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.owner = owner;
}
 
/**
* @return Collection(MailAliasDestination)
*
82,11 → 111,25
* @hibernate.collection-key column="alias"
* @hibernate.collection-one-to-many class="ak.hostcaptain.core.model.MailAliasDestination"
*/
public Collection getDestinations()
protected Collection getDestinations()
{
return destinations;
}
 
/**
* @return Collection(MailAliasDestination)
*/
public Collection getDestinations(User editor)
throws ModelException
{
if(mayChangeDestinations(editor))
return destinations;
else if(viewableBy(editor))
return java.util.Collections.unmodifiableCollection(destinations);
else
throw new ModelSecurityException();
}
 
/**
* @param destinations Collection(MailAliasDestination)
*/
120,8 → 163,20
return user.isSuperuser() || user.equals(domain.getOwner());
}
 
public boolean mayChangeDestinations(User user)
{
return user.isSuperuser() || user.equals(domain.getOwner()) || user.equals(owner);
}
 
public boolean deleteableBy(User user)
{
return user.isSuperuser() || user.equals(domain.getOwner());
}
 
protected static boolean allowedToCreate(MailAliasManager manager, User editor)
throws ModelException
{
return editor.isSuperuser()
|| InetDomainManager.getInstance().areInetDomainsAvailable(editor);
}
}
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/SystemUserManager.java
45,7 → 45,7
public boolean allowedToCreate(User editor)
throws ModelException
{
return editor.isSuperuser();
return SystemUser.allowedToCreate(this, editor);
}
 
public SystemUser get(User editor, Long id)
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/InetDomainManager.java
45,7 → 45,7
public boolean allowedToCreate(User editor)
throws ModelException
{
return editor.isSuperuser();
return InetDomain.allowedToCreate(this, editor);
}
 
public InetDomain get(User editor, Long id)
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/SystemUser.java
1,5 → 1,8
package ak.hostcaptain.core.model;
 
import ak.hostcaptain.util.ModelException;
import ak.hostcaptain.util.ModelSecurityException;
 
/**
*
* @hibernate.class table="systemusers"
27,7 → 30,7
return id;
}
 
public void setId(Long id)
protected void setId(Long id)
{
this.id = id;
}
41,11 → 44,20
return uid;
}
 
public void setUid(Integer uid)
protected void setUid(Integer uid)
{
this.uid = uid;
}
 
public void setUid(User editor, Integer uid)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.uid = uid;
}
 
/**
*
* @hibernate.property
55,11 → 67,20
return name;
}
 
public void setName(String name)
protected void setName(String name)
{
this.name = name;
}
 
public void setName(User editor, String name)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.name = name;
}
 
/**
*
* @hibernate.many-to-one
69,11 → 90,20
return owner;
}
 
public void setOwner(User owner)
protected void setOwner(User owner)
{
this.owner = owner;
}
 
public void setOwner(User editor, User owner)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.owner = owner;
}
 
public String getTypeKey()
{
return ak.hostcaptain.core.CoreResources.TYPE_SYSTEM_USER;
103,4 → 133,10
{
return user.isSuperuser();
}
 
protected static boolean allowedToCreate(SystemUserManager manager, User editor)
throws ModelException
{
return editor.isSuperuser();
}
}
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/GeneralModelObject.java
21,7 → 21,7
return enabled;
}
 
public void setEnabled(Boolean enabled)
protected void setEnabled(Boolean enabled)
{
this.enabled = enabled;
}
44,7 → 44,7
return comment;
}
 
public void setComment(String comment)
protected void setComment(String comment)
{
this.comment = comment;
}
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/MailboxManager.java
46,8 → 46,7
public boolean allowedToCreate(User editor)
throws ModelException
{
return editor.isSuperuser()
|| InetDomainManager.getInstance().areInetDomainsAvailable(editor);
return Mailbox.allowedToCreate(this, editor);
}
 
public Mailbox get(User editor, Long id)
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/InetDomain.java
1,5 → 1,8
package ak.hostcaptain.core.model;
 
import ak.hostcaptain.util.ModelException;
import ak.hostcaptain.util.ModelSecurityException;
 
/**
*
* @hibernate.class table="domains"
24,7 → 27,7
return id;
}
 
public void setId(Long id)
protected void setId(Long id)
{
this.id = id;
}
38,11 → 41,20
return name;
}
 
public void setName(String name)
protected void setName(String name)
{
this.name = name;
}
 
public void setName(User editor, String name)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.name = name;
}
 
/**
*
* @hibernate.many-to-one
52,11 → 64,20
return owner;
}
 
public void setOwner(User owner)
protected void setOwner(User owner)
{
this.owner = owner;
}
 
public void setOwner(User editor, User owner)
throws ModelException
{
if(!editableBy(editor))
throw new ModelSecurityException();
 
this.owner = owner;
}
 
public String getTypeKey()
{
return ak.hostcaptain.core.CoreResources.TYPE_DOMAIN;
86,4 → 107,10
{
return user.isSuperuser();
}
 
protected static boolean allowedToCreate(InetDomainManager manager, User editor)
throws ModelException
{
return editor.isSuperuser();
}
}
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/MailAliasManager.java
48,8 → 48,7
public boolean allowedToCreate(User editor)
throws ModelException
{
return editor.isSuperuser()
|| InetDomainManager.getInstance().areInetDomainsAvailable(editor);
return MailAlias.allowedToCreate(this, editor);
}
 
public MailAlias get(User editor, Long id)