Rev 1306 |
Rev 1405 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package pt.estgp.estgweb.domain;
/**
* @author Jorge Machado
* @date 2/Mar/2008
* @time 10:27:25
* @see pt.estgp.estgweb.domain
*/
public class UserImpl
extends User
{
private boolean newUser =
false;
public UserImpl
()
{
}
public boolean isNewUser
()
{
return newUser
;
}
public void setNewUser
(boolean newUser
)
{
this.
newUser = newUser
;
}
/**
* check if user is in some group
*
* @param g to check
* @return true if belongs to group
*/
public boolean hasGroup
(1.5.0/docs/api/java/security/acl/Group.html">Group g
)
{
if (getGroups
() ==
null)
return false;
for (1.5.0/docs/api/java/security/acl/Group.html">Group group : getGroups
())
{
if (group.
getId() == g.
getId())
return true;
}
return false;
}
public boolean hasPopConfigured
()
{
return getPop3server
() !=
null && getPop3username
() !=
null && getPop3password
() !=
null;
}
public boolean isInCourseUnit
(long id
)
{
return isInCourseUnit
(id,
false);
}
public boolean isInCourseUnit
(long id,
boolean transaction
)
{
if(this instanceof TeacherImpl
)
{
return ((TeacherImpl
)this).
hasCourseUnit(id,transaction
);
}
else if(this instanceof StudentImpl
)
{
return ((StudentImpl
)this).
hasCourseUnit(id,transaction
);
}
return false;
}
public boolean isTeacherOfCourseUnit
(long id
)
{
return isTeacherOfCourseUnit
(id,
false);
}
public boolean isTeacherOfCourseUnit
(long id,
boolean transaction
)
{
if(this instanceof TeacherImpl
)
{
return ((TeacherImpl
)this).
hasCourseUnit(id,transaction
);
}
return false;
}
public boolean isStudentfCourseUnit
(long id
)
{
return isStudentfCourseUnit
(id,
false);
}
public boolean isStudentfCourseUnit
(long id,
boolean transaction
)
{
if(this instanceof StudentImpl
)
{
return ((StudentImpl
)this).
hasCourseUnit(id,transaction
);
}
return false;
}
// Duarte Santos
public boolean haveResponse
(Survey s, SurveyStructuralNode node
)
{
for(SurveyResponse r : getMySurveyResponses
())
{
if(r.
getStructuralNode().
getSurvey() == s
&& r.
getStructuralNode() == node
)
return true;
}
return false;
}
/*public String getPop3PassDecrypted()
{
return DesUtils.getInstance().decrypt(getPop3password());
}*/
}