2001-07-09 20:15:51 +00:00
|
|
|
/**
|
2002-06-26 17:21:02 +00:00
|
|
|
* check if site is online
|
2001-12-10 23:43:11 +00:00
|
|
|
* @param Obj Userobject
|
2003-01-02 18:55:32 +00:00
|
|
|
* @param Int Permission-Level
|
2002-06-26 17:21:02 +00:00
|
|
|
* @return String String indicating that site is not public (or null if public)
|
2001-07-09 20:15:51 +00:00
|
|
|
*/
|
|
|
|
|
2003-01-02 18:55:32 +00:00
|
|
|
function isNotPublic(usr,level) {
|
2002-12-01 19:26:40 +00:00
|
|
|
if (!this.online) {
|
|
|
|
if (usr && usr.sysadmin)
|
2002-03-27 11:26:14 +00:00
|
|
|
return null;
|
2003-01-23 21:35:06 +00:00
|
|
|
else if (level != null)
|
2002-03-27 11:26:14 +00:00
|
|
|
return null;
|
2002-12-01 19:26:40 +00:00
|
|
|
return "siteNotPublic";
|
2002-03-27 11:26:14 +00:00
|
|
|
}
|
2001-09-05 21:15:45 +00:00
|
|
|
return null;
|
2002-03-27 11:26:14 +00:00
|
|
|
|
2001-07-09 20:15:51 +00:00
|
|
|
}
|
|
|
|
|
2001-06-18 08:57:33 +00:00
|
|
|
/**
|
2002-06-26 17:21:02 +00:00
|
|
|
* check if user is allowed to edit the preferences of this site
|
2001-12-10 23:43:11 +00:00
|
|
|
* @param Obj Userobject
|
2003-01-02 18:55:32 +00:00
|
|
|
* @param Int Permission-Level
|
2001-12-10 23:43:11 +00:00
|
|
|
* @return String Reason for denial (or null if allowed)
|
2001-06-18 08:57:33 +00:00
|
|
|
*/
|
|
|
|
|
2003-01-02 18:55:32 +00:00
|
|
|
function isEditDenied(usr,level) {
|
2002-12-01 19:26:40 +00:00
|
|
|
if (usr.sysadmin)
|
2002-03-27 11:26:14 +00:00
|
|
|
return null;
|
2003-01-02 18:55:32 +00:00
|
|
|
if ((level & MAY_EDIT_PREFS) == 0)
|
2002-12-01 19:26:40 +00:00
|
|
|
return "siteEditDenied";
|
2001-09-05 21:15:45 +00:00
|
|
|
return null;
|
2001-06-28 18:09:37 +00:00
|
|
|
}
|
|
|
|
|
2002-03-27 11:26:14 +00:00
|
|
|
/**
|
2002-06-26 17:21:02 +00:00
|
|
|
* check if user is allowed to delete the site
|
|
|
|
* (only SysAdmins or the creator of a site are allowed to delete it!)
|
2002-03-27 11:26:14 +00:00
|
|
|
* @param Obj Userobject
|
|
|
|
* @return String Reason for denial (or null if allowed)
|
|
|
|
*/
|
|
|
|
|
|
|
|
function isDeleteDenied(usr) {
|
2002-12-01 19:26:40 +00:00
|
|
|
if (!usr.sysadmin && usr != this.creator)
|
|
|
|
return "siteDeleteDenied";
|
2002-03-27 11:26:14 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2001-07-01 19:27:28 +00:00
|
|
|
/**
|
|
|
|
* function checks if user is allowed to sign up
|
2001-12-10 23:43:11 +00:00
|
|
|
* @param Obj Userobject
|
2003-01-02 18:55:32 +00:00
|
|
|
* @param Int Permission-Level
|
2001-12-10 23:43:11 +00:00
|
|
|
* @return String Reason for denial (or null if allowed)
|
2001-07-01 19:27:28 +00:00
|
|
|
*/
|
|
|
|
|
2003-01-02 18:55:32 +00:00
|
|
|
function isSubscribeDenied(usr,level) {
|
2003-01-23 21:35:06 +00:00
|
|
|
if (level != null)
|
2002-12-01 19:26:40 +00:00
|
|
|
return "subscriptionExist";
|
|
|
|
else if (!this.online)
|
|
|
|
return "siteNotPublic";
|
2001-09-05 21:15:45 +00:00
|
|
|
return null;
|
2001-07-01 19:27:28 +00:00
|
|
|
}
|
|
|
|
|
2002-01-22 20:21:13 +00:00
|
|
|
/**
|
|
|
|
* check if user is allowed to unsubscribe
|
|
|
|
* @param Obj Userobject
|
|
|
|
* @return String Reason for denial (or null if allowed)
|
|
|
|
*/
|
|
|
|
|
2003-01-02 18:55:32 +00:00
|
|
|
function isUnsubscribeDenied(usr,level) {
|
2003-01-23 21:35:06 +00:00
|
|
|
if (level == null)
|
2002-12-01 19:26:40 +00:00
|
|
|
return "subscriptionNoExist";
|
2003-01-23 21:35:06 +00:00
|
|
|
else if (level > SUBSCRIBER)
|
2002-12-01 19:26:40 +00:00
|
|
|
return "unsubscribeDenied";
|
2002-01-22 20:21:13 +00:00
|
|
|
return null;
|
|
|
|
}
|
2001-07-01 19:27:28 +00:00
|
|
|
|