Scarab commit: svn commit: r10784 - trunk: . src/java/org/tigris/scarab/tools src/webapp/WEB-INF/templates/viewIssue xdocs
Hussayn Dabbous <[email protected]>
| Newsgroups | gmane.comp.java.scarab.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dabbous
Date: 2009-07-11 06:47:10-0700
New Revision: 10784
Modified:
trunk/project.properties
trunk/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java
trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueBody.vm
trunk/xdocs/scarab_properties.xml
Log:
SCB2982: Added new project properties with default settings:
scarab.common.status.id=status (already existed before, here for documentation)
scarab.common.status.sealed=closed
scarab.common.status.sealed.modifyPermission=Domain | Edit
These properties control on a system wide scope under which
conditions a user needs higher privilege to modify an issue.
The defualt is interpreted as:
if issue is in status "closed"
then editor needs permission "Domain | Edit"
to modify the issue.
Added support method: in ScarabGlobal: getRequiredModifyPermission(Issue issue)
Fixed ViewIssueBody to support dynamic edit permissions.
Modified: trunk/project.properties
Url: http://scarab.tigris.org/source/browse/scarab/trunk/project.properties?view=diff&pathrev=10784&r1=10783&r2=10784
==============================================================================
--- trunk/project.properties (original)
+++ trunk/project.properties 2009-07-11 06:47:10-0700
@@ -869,13 +869,33 @@
# End of Group LDAP authentication
# ================================
+
+# ===============
+# Group: Workflow
+# ===============
+#
+# scarab.workflow.classname
+# scarab.notificationmanager.classname
+# scarab.notificationmanager.issuequiettime
+# scarab.instance.id
+# scarab.common.status.id
+# scarab.common.status.sealed
+# scarab.common.status.sealed.modifyPermission
+#
+# Helper properties for the workflow.
+# Note: Some of these properties are temporary "hacks"
+# until the workf.ow engine has been improved in such a
+# way that it can be configured through the Webinterface.
+#
+
+
# -------------------------
# scarab.workflow.classname
# -------------------------
#
#
# The workflow tool to be used by Scarab.
-#
+#
scarab.workflow.classname=org.tigris.scarab.workflow.CheapWorkflow
@@ -885,7 +905,7 @@
#
#
# The implementation of NotificationManager to be used by Scarab.
-#
+#
scarab.notificationmanager.classname=org.tigris.scarab.notification.ScarabNotificationManager
@@ -899,7 +919,7 @@
# from the time of last activity on the issue until the current
# time. Time unit is [msec], e.g. 300000 is equivalent to a
# waiting time of 5 minutes.
-#
+#
scarab.notificationmanager.issuequiettime=300000
@@ -942,6 +962,34 @@
scarab.common.status.id=status
+# ---------------------------
+# scarab.common.status.sealed
+# ---------------------------
+#
+#
+# The given issue is recognized as sealed when the status attribute
+# been set to the given value. The default behaviour is:
+# ue is sealed if (status == closed)
+#
+
+scarab.common.status.sealed=closed
+
+# --------------------------------------------
+# scarab.common.status.sealed.modifyPermission
+# --------------------------------------------
+#
+#
+# When the given issue is in $status=$sealed (aka status=closed)
+# then the required edit permission will be determined by this
+# property (default = Domain__Edit)
+#
+
+scarab.common.status.sealed.modifyPermission=Domain | Edit
+
+# =====================
+# End of Group Workflow
+# =====================
+
# =========================
# Group: Turbine-properties
Modified: trunk/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java?view=diff&pathrev=10784&r1=10783&r2=10784
==============================================================================
--- trunk/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java (original)
+++ trunk/src/java/org/tigris/scarab/tools/ScarabGlobalTool.java 2009-07-11 06:47:10-0700
@@ -80,6 +80,8 @@
import org.tigris.scarab.om.AttributePeer;
import org.tigris.scarab.om.IssueTypePeer;
+import org.tigris.scarab.om.AttributeValue;
+import org.tigris.scarab.om.Issue;
import org.tigris.scarab.om.NotificationRule;
import org.tigris.scarab.om.NotificationRuleManager;
import org.tigris.scarab.om.NotificationRulePeer;
@@ -211,6 +213,56 @@
{
return security;
}
+
+ /**
+ * Determine which permission is needed to modify the given issue
+ * The result may vary depending on the issue state!
+ * Note: Currently the issue "state" is not exactly defined.
+ * Therefore this method checks for existence of an attribute
+ * named according to the system property
+ *
+ * scarab.common.status.id=status
+ *
+ * If such an attribute is available within the given issue, the method checks
+ * if the issue value is the same as in the given system property
+ *
+ * scarab.common.status.sealed=closed
+ *
+ * So if the default case applies ( status==closed)
+ *
+ * Then the returned permission is determined by the system property:
+ *
+ * scarab.common.status.sealed.modifyPermission=Domain__Edit
+ *
+ * All three properties are runtime properties which can be specified
+ * in the build.properties or in the custom.properties
+ * @return
+ * @throws TorqueException
+ */
+ public String getRequiredModifyPermission(Issue issue) throws TorqueException
+ {
+ String editPermission = ScarabSecurity.ISSUE__EDIT;
+
+ String status = getTurbineProperty("scarab.common.status.id");
+ if (status != null)
+ {
+ String value = getTurbineProperty("scarab.common.status.sealed");
+ if(value != null)
+ {
+ AttributeValue attval = issue.getAttributeValue(status);
+ if(attval.getValue().equals(value))
+ {
+ String permissionString = getTurbineProperty("scarab.common.status.sealed.modifyPermission");
+ if(permissionString != null)
+ {
+ editPermission = permissionString;
+ }
+ }
+ }
+ }
+ return editPermission;
+ }
+
/**
* holds the names of parameters that are configurable through the ui.
Modified: trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueBody.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueBody.vm?view=diff&pathrev=10784&r1=10783&r2=10784
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueBody.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueBody.vm 2009-07-11 06:47:10-0700
@@ -1,10 +1,11 @@
-#set ($module = $currentIssue.Module)
-#set ($issueType = $currentIssue.IssueType)
-#set ($fullHistory = $data.Parameters.getString("fullhistory",""))
-#set ($fullComments = $data.Parameters.getString("fullcomments",""))
-#set ($rmit = $module.getRModuleIssueType($issueType))
-#set ($canEdit = $scarabR.hasPermission($scarabG.Permission.ISSUE__EDIT, $module) && $rmit.Active)
-#set ($attrValues = $currentIssue.ModuleAttributeValuesMap)
+#set ($module = $currentIssue.Module)
+#set ($issueType = $currentIssue.IssueType)
+#set ($fullHistory = $data.Parameters.getString("fullhistory",""))
+#set ($fullComments = $data.Parameters.getString("fullcomments",""))
+#set ($rmit = $module.getRModuleIssueType($issueType))
+#set ($permission = $scarabG.getRequiredModifyPermission($currentIssue) )
+#set ($canEdit = $scarabR.hasPermission($permission, $module) && $rmit.Active)
+#set ($attrValues = $currentIssue.ModuleAttributeValuesMap)
#set ($currentIssueId = $currentIssue.UniqueId)
#set ($myself = $data.User.userId)
Modified: trunk/xdocs/scarab_properties.xml
Url: http://scarab.tigris.org/source/browse/scarab/trunk/xdocs/scarab_properties.xml?view=diff&pathrev=10784&r1=10783&r2=10784
==============================================================================
--- trunk/xdocs/scarab_properties.xml (original)
+++ trunk/xdocs/scarab_properties.xml 2009-07-11 06:47:10-0700
@@ -980,69 +980,78 @@
</details>
</property>
</group>
-
- <property>
- <name>scarab.workflow.classname</name>
- <default>org.tigris.scarab.workflow.CheapWorkflow</default>
- <details>
- The workflow tool to be used by Scarab.
- </details>
- <type>Runtime</type>
- <file/>
- </property>
-
- <property>
- <name>scarab.notificationmanager.classname</name>
- <default>org.tigris.scarab.notification.ScarabNotificationManager</default>
- <details>
- The implementation of NotificationManager to be used by Scarab.
- </details>
- <type>Runtime</type>
- <comment>
- The implementation of NotificationManager to be used by Scarab.
- </comment>
- </property>
- <property>
- <name>scarab.notificationmanager.issuequiettime</name>
- <default>300000</default>
+
+ <group name="Workflow">
<details>
- Waiting time after which all queued notifications for an issue
- are sent to their recipients. The waiting time is measured begining
- from the time of last activity on the issue until the current
- time. Time unit is [msec], e.g. 300000 is equivalent to a
- waiting time of 5 minutes.
+ Helper properties for the workflow.
+ Note: Some of these properties are temporary "hacks"
+ until the workf.ow engine has been improved in such a
+ way that it can be configured through the Webinterface.
</details>
- <type>Runtime</type>
- <comment>
- Waiting time after which a queued notification is sent to recipients in [msec]
- </comment>
- </property>
-
- <property>
- <name>scarab.instance.id</name>
- <default>local</default>
- <comment/>
- <type>Runtime</type>
- <customization modification="optional">advanced</customization>
- <file/>
- <details>
+
+ <property>
+ <name>scarab.workflow.classname</name>
+ <default>org.tigris.scarab.workflow.CheapWorkflow</default>
+ <details>
+ The workflow tool to be used by Scarab.
+ </details>
+ <type>Runtime</type>
+ <file/>
+ </property>
+
+ <property>
+ <name>scarab.notificationmanager.classname</name>
+ <default>org.tigris.scarab.notification.ScarabNotificationManager</default>
+ <details>
+ The implementation of NotificationManager to be used by Scarab.
+ </details>
+ <type>Runtime</type>
+ <comment>
+ The implementation of NotificationManager to be used by Scarab.
+ </comment>
+ </property>
+
+ <property>
+ <name>scarab.notificationmanager.issuequiettime</name>
+ <default>300000</default>
+ <details>
+ Waiting time after which all queued notifications for an issue
+ are sent to their recipients. The waiting time is measured begining
+ from the time of last activity on the issue until the current
+ time. Time unit is [msec], e.g. 300000 is equivalent to a
+ waiting time of 5 minutes.
+ </details>
+ <type>Runtime</type>
+ <comment>
+ Waiting time after which a queued notification is sent to recipients in [msec]
+ </comment>
+ </property>
+
+ <property>
+ <name>scarab.instance.id</name>
+ <default>local</default>
+ <comment/>
+ <type>Runtime</type>
+ <customization modification="optional">advanced</customization>
+ <file/>
+ <details>
This name will be used to distinguish specific scarab instances
from other instances that it may interact with (in the future).
It is the prefix to all issue ids created in response to an
issue entered against a module in this instance's database.
per default this value is set to "local" .
- </details>
- </property>
-
- <property>
- <name>scarab.common.status.id</name>
- <default>status</default>
- <comment/>
- <type>Runtime</type>
- <customization modification="optional">advanced</customization>
- <file/>
- <details>
+ </details>
+ </property>
+
+ <property>
+ <name>scarab.common.status.id</name>
+ <default>status</default>
+ <comment/>
+ <type>Runtime</type>
+ <customization modification="optional">advanced</customization>
+ <file/>
+ <details>
Every issue tracking system has got an attribute, that keeps
the current status of the handled issues, i.e. it stores whether
an issue has been created, closed, reopened and so on.
@@ -1059,8 +1068,37 @@
given instance. And the only place where we use this property
is during generation of the E-Mail headers for issue change
notifications.
- </details>
- </property>
+ </details>
+ </property>
+
+ <property>
+ <name>scarab.common.status.sealed</name>
+ <default>closed</default>
+ <comment/>
+ <type>Runtime</type>
+ <customization modification="optional">advanced</customization>
+ <file/>
+ <details>
+ The given issue is recognized as sealed when the status attribute
+ has been set to the given value. The default behaviour is:
+ Issue is sealed if (status == closed)
+ </details>
+ </property>
+
+ <property>
+ <name>scarab.common.status.sealed.modifyPermission</name>
+ <default>Domain | Edit</default>
+ <comment/>
+ <type>Runtime</type>
+ <customization modification="optional">advanced</customization>
+ <file/>
+ <details>
+ When the given issue is in $status=$sealed (aka status=closed)
+ then the required edit permission will be determined by this
+ property (default = Domain__Edit)
+ </details>
+ </property>
+ </group>
<group name="Turbine-properties">
<details>
------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2370662