Skip to content

Commit

Permalink
SAK-8060 KNL-60
Browse files Browse the repository at this point in the history
Specify site quotas on a user, user type, or site basis

Applied the kernel part of this patch to BaseCotent Service

Patch supplied by  	 Feliz Gouveia

Thanks


git-svn-id: https://source.sakaiproject.org/svn/kernel/trunk@52713 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
ieb committed Sep 26, 2008
1 parent fc9f4fc commit 8e728f1
Showing 1 changed file with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8239,9 +8239,34 @@ protected long bytes2k(long bytes)
public long getQuota(ContentCollection collection) {
long quota = 0;

// use this quota unless we have one more specific
quota = m_siteQuota;
// parse a string like /user/344454534543534535353543535
String[] parts = StringUtil.split(collection.getId(), Entity.SEPARATOR);
if (parts.length >= 3) {
String siteId = null;

// SITE_ID come in 2 forms (~siteid||siteid)
if (parts[1].equals("user")) {
siteId = "~" + parts[2];
} else {
siteId = parts[2];
}

String siteType = null;
// get the site type
try {
siteType = m_siteService.getSite(siteId).getType();
} catch (IdUnusedException e) {
M_log.warn("SiteService could not find the site type");
}

// use this quota unless we have one more specific
if (siteType != null) {
quota = Long.parseLong(m_serverConfigurationService.getString("content.quota." + siteType, Long.toString(m_siteQuota)));
}
} else {
quota = m_siteQuota;
}

// see if this collection has a quota property
try
{
Expand Down

0 comments on commit 8e728f1

Please sign in to comment.