Scarab commit: svn commit: r11318 - branches/scarab_11079_legacy_with_ant_maven1/src: conf/classes conf/conf java/org/tigris/scarab/om schema sql/upgrade webapp/WEB-INF/templates/macros webapp/WEB-INF/templates/screens/admin webapp/WEB-INF/templates/viewIssue
[email protected] Fri, 23 Nov 2012 03:38:51 -0800 (PST)
| Newsgroups | gmane.comp.java.scarab.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dabbous
Date: 2012-11-23 03:38:51-0800
New Revision: 11318
Added:
branches/scarab_11079_legacy_with_ant_maven1/src/sql/upgrade/upgrade-0.2=
4-scarab_attribute_group.sql
Modified:
branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/ScarabBund=
le_de.properties
branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/ScarabBund=
le_en.properties
branches/scarab_11079_legacy_with_ant_maven1/src/conf/conf/intake.xml
branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab/=
om/AttributeGroup.java
branches/scarab_11079_legacy_with_ant_maven1/src/schema/scarab-schema.xm=
l
branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/template=
s/macros/GlobalMacros.vm
branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/template=
s/screens/admin/AttributeGroupEdit.vm
branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/template=
s/viewIssue/ViewIssueTab1.vm
Log:
Added read only attribute groups (edit for role)
new db field SCARAB_ATTRIBUTE_GROUP:EDIT_ROLE_ID
added access methods, intake declaration, schema update
modified issue editor and new Issue wizzard.
Added GUI strings for i18n
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/Sca=
rabBundle_de.properties
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/conf/classes/ScarabBundle_de.properties?view=3Ddif=
f&pathrev=3D11318&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/ScarabBun=
dle_de.properties=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/ScarabBun=
dle_de.properties=092012-11-23 03:38:51-0800
@@ -511,6 +511,7 @@
=20
##Edit Module
RoleNeededForViewing=3DSichtbar f=C3=BCr Rolle
+RoleNeededForEditing=3D=C3=84nderbar f=C3=BCr Rolle
=20
##SelectModule
RequestRolesInOtherModules=3Dzur Nutzung von weiteren Modulen.
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/Sca=
rabBundle_en.properties
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/conf/classes/ScarabBundle_en.properties?view=3Ddif=
f&pathrev=3D11318&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/ScarabBun=
dle_en.properties=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/conf/classes/ScarabBun=
dle_en.properties=092012-11-23 03:38:51-0800
@@ -562,6 +562,8 @@
=20
##Edit Module
RoleNeededForViewing=3DVisible by role
+RoleNeededForEditing=3DEditable by role
+
##SelectModule
RequestRolesInOtherModules=3Dto access other modules.
CurrentModule=3DCurrently selected module
@@ -1003,7 +1005,6 @@
IssueTypes=3DIssue types
GroupNotFound=3DGroup not found. To proceed, please click
AttributeGroupInfo=3DAttribute group information
-RoleNeededForViewing=3DRole needed for viewing
ClickAddButton=3DClick the "Add" button to add attributes to this group.
AttributesInGroup=3DAttributes in this group
PerProjectName=3DPer project name
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/conf/conf/intake=
.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/conf/conf/intake.xml?view=3Ddiff&pathrev=3D11318&r=
1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/conf/conf/intake.xml=
=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/conf/conf/intake.xml=
=092012-11-23 03:38:51-0800
@@ -158,6 +158,7 @@
<rule name=3D"maxLength" value=3D"255">intake_AttributeGroupDe=
scriptionMustBeLessThan255Characters</rule>
</field>
<field name=3D"ViewRoleId" key=3D"roleview" type=3D"int"></field>
+ <field name=3D"EditRoleId" key=3D"roleedit" type=3D"int"></field>
<field name=3D"Active" key=3D"act" type=3D"boolean"/>
<field name=3D"Order" key=3D"order" type=3D"int" mapToProperty=3D"=
Order">
<rule name=3D"minValue" value=3D"1">intake_EnterValueGreaterTha=
n0</rule>
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/=
scarab/om/AttributeGroup.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/java/org/tigris/scarab/om/AttributeGroup.java?view=
=3Ddiff&pathrev=3D11318&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab=
/om/AttributeGroup.java=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/java/org/tigris/scarab=
/om/AttributeGroup.java=092012-11-23 03:38:51-0800
@@ -718,6 +718,32 @@
return role;
}
=20
+ /**
+ * Returns the role needed for "edit" this attributegroup.
+ * @return
+ */
+ public Role getRole4Edit()
+ {
+ Role role =3D null;
+ if (this.getEditRoleId() !=3D null && this.getEditRoleId().intValu=
e() !=3D -1)
+ {
+ try
+ {
+ role =3D TurbineRolePeer.retrieveByPK(this.getEditRoleId()=
);
+ }
+ catch (NoRowsException e)
+ {
+ // No error.
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } =20
+ }
+ return role;
+ }
+ =20
/** Can this AttributeGroup be viewed by the user.=20
*=20
* @param user can be null.
@@ -755,4 +781,43 @@
}
return bRdo;=09
}
+ =20
+ /** Can this AttributeGroup be edited by the user.=20
+ *=20
+ * @param user can be null.
+ * @return
+ * @throws TorqueException
+ */
+ public boolean isEditable4User(ScarabUser user) throws TorqueException
+ {
+ Role role =3D this.getRole4Edit();
+ boolean bRdo =3D false;
+ if (role =3D=3D null)
+ {
+ bRdo =3D true;
+ }
+ else
+ {
+ if (user !=3D null)
+ {
+ try
+ {
+ AccessControlList acl =3D TurbineSecurity.getACL(user);
+ GroupSet allGroups =3D TurbineSecurity.getAllGroups();
+ Group group =3D allGroups.getGroup(user.getCurrentModu=
le().getName());
+ bRdo =3D acl.hasRole(role, group);
+ }
+ catch(org.apache.fulcrum.security.util.DataBackendExceptio=
n dbe)
+ {
+ throw new TorqueException("failed to get user's groups=
", dbe);
+ }
+ catch(org.apache.fulcrum.security.util.UnknownEntityExcept=
ion uee)
+ {
+ throw new TorqueException("failed to get user's groups=
", uee);
+ }
+ }
+ }
+ return bRdo; =20
+ }
+ =20
}
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/schema/scarab-sc=
hema.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/schema/scarab-schema.xml?view=3Ddiff&pathrev=3D113=
18&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/schema/scarab-schema.x=
ml=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/schema/scarab-schema.x=
ml=092012-11-23 03:38:51-0800
@@ -194,6 +194,7 @@
=09=09<column name=3D"DEDUPE" required=3D"false" type=3D"BOOLEANINT" defau=
lt=3D"0" javaType=3D"primitive"/>
=09=09<column name=3D"PREFERRED_ORDER" javaName=3D"Order" required=3D"fals=
e" default=3D"-1" type=3D"INTEGER" javaType=3D"primitive"/>
<column name=3D"VIEW_ROLE_ID" type=3D"INTEGER"></column>
+ <column name=3D"EDIT_ROLE_ID" type=3D"INTEGER"></column>
=09=09<foreign-key foreignTable=3D"SCARAB_MODULE">
=09=09=09<reference local=3D"MODULE_ID" foreign=3D"MODULE_ID"/>
=09=09</foreign-key>
Added: branches/scarab_11079_legacy_with_ant_maven1/src/sql/upgrade/upgrade=
-0.24-scarab_attribute_group.sql
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/sql/upgrade/upgrade-0.24-scarab_attribute_group.sq=
l?view=3Dmarkup&pathrev=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- (empty file)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/sql/upgrade/upgrade-0.=
24-scarab_attribute_group.sql=092012-11-23 03:38:51-0800
@@ -0,0 +1,6 @@
+/*
+ * This upgrade script adds a new column to the SCARAB_ATTRIBUTE_GROUP tab=
le.
+ *
+ * Created By: Hussayn Dabbous
+ */
+ALTER TABLE SCARAB_ATTRIBUTE_GROUP add ( EDIT_ROLE_ID INTEGER default -1);
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/t=
emplates/macros/GlobalMacros.vm
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm?vi=
ew=3Ddiff&pathrev=3D11318&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/templat=
es/macros/GlobalMacros.vm=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/templat=
es/macros/GlobalMacros.vm=092012-11-23 03:38:51-0800
@@ -1232,7 +1232,7 @@
<div class=3D"axial">
#foreach ($group in $moduleAttributeGroups)
#set ($attributes =3D $group.Attributes)
- #if ($attributes && !$attributes.isEmpty() && $group.isVisible4User(=
$user))
+ #if ($attributes && !$attributes.isEmpty() && $group.isVisible4User($use=
r) && $group.isEditable4User($user))
<h4>$group.Name #asterisk()</h4>
<table cellpadding=3D"3" cellspacing=3D"2" border=3D"0" width=3D"100%">
#set ($appendToNextLine =3D "")
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/t=
emplates/screens/admin/AttributeGroupEdit.vm
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/webapp/WEB-INF/templates/screens/admin/AttributeGr=
oupEdit.vm?view=3Ddiff&pathrev=3D11318&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/templat=
es/screens/admin/AttributeGroupEdit.vm=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/templat=
es/screens/admin/AttributeGroupEdit.vm=092012-11-23 03:38:51-0800
@@ -52,23 +52,41 @@
#end
</td>
</tr>
+=20
<tr>
- <th>$l10n.Description</th>
- <td>
- #if ($issueTypeLocked || $immutable)
- $!group.Description
- #else
- #textAreaMedium("$agGroup.Description.Key" $agGroup.Description.Value=
)</td>
- #end
+ <th>$l10n.Description</th>
+ <td colspan=3D3>
+ #if ($issueTypeLocked || $immutable)
+ $!group.Description
+ #else
+ #textAreaMedium("$agGroup.Description.Key" $agGroup.Description.Val=
ue)
+ #end
+ </td>
</tr>
- <th>$l10n.RoleNeededForViewing</th>
- <td>
-=09<select name=3D"$agGroup.ViewRoleId.Key">
-=09 <option selected=3D"selected" value=3D"-1" >$l10n.TransitionsAnyRole<=
/option>
-=09 #foreach ($role in $securityAdmin.Roles)
-=09 <option value=3D"$role.RoleId" #if ($role.roleId =3D=3D $group.view=
RoleId) selected #end>$role.Name</option>
-=09 #end
-=09</select>=20
+=20
+ <tr>
+ <th style=3D"white-space: nowrap;">$l10n.RoleNeededForViewing</th>
+ <td>
+ <select name=3D"$agGroup.ViewRoleId.Key">
+ <option selected=3D"selected" value=3D"-1" >$l10n.TransitionsAnyRole=
</option>
+ #foreach ($role in $securityAdmin.Roles)
+ <option value=3D"$role.RoleId" #if ($role.roleId =3D=3D $group.v=
iewRoleId) selected #end>$role.Name</option>
+ #end
+ </select>=20
+ </td>
+ =20
+ <th style=3D"white-space: nowrap;">$l10n.RoleNeededForEditing</th>
+ <td width=3D"100%">
+ <select name=3D"$agGroup.EditRoleId.Key">
+ <option selected=3D"selected" value=3D"-1" >$l10n.TransitionsAnyRole=
</option>
+ #foreach ($role in $securityAdmin.Roles)
+ <option value=3D"$role.RoleId" #if ($role.roleId =3D=3D $group.e=
ditRoleId) selected #end>$role.Name</option>
+ #end
+ </select>=20
+ </td>
+ =20
+ =20
+ =20
</tr>=20
</table>
</div>
Modified: branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/t=
emplates/viewIssue/ViewIssueTab1.vm
Url: http://scarab.tigris.org/source/browse/scarab/branches/scarab_11079_le=
gacy_with_ant_maven1/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.v=
m?view=3Ddiff&pathrev=3D11318&r1=3D11317&r2=3D11318
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/templat=
es/viewIssue/ViewIssueTab1.vm=09(original)
+++ branches/scarab_11079_legacy_with_ant_maven1/src/webapp/WEB-INF/templat=
es/viewIssue/ViewIssueTab1.vm=092012-11-23 03:38:51-0800
@@ -8,7 +8,7 @@
## MACRO SECTION
## =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
-#macro (displayAttributeInCanvas $att $colspan)
+#macro (displayAttributeInCanvas $att $colspan $userCanEditGroup)
=20
## =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
## Note that this macro depends on 2 global variables:
@@ -82,7 +82,7 @@
#end
=20
=20
- #if ($isEditAttributes)
+ #if ($isEditAttributes && $userCanEditGroup)
=20
#if ($onSameLine)
#set ($isHidden =3D !( $currentIssue.isRequiredAttributeFor($att,=
$user) || $rma.Visible || $currentColumn=3D=3D1 ) )
@@ -260,7 +260,7 @@
## tell the macro where we are in the table and then execute it
#set ($currentRow=3D0)
#set ($currentColumn=3D0)
- #displayAttributeInCanvas ($myStatusAttribute 1)
+ #displayAttributeInCanvas ($myStatusAttribute 1 true)
</td></tr>
#end
</table>
@@ -282,7 +282,7 @@
## tell the macro where we are in the table and then execute it
#set ($currentRow=3D0)
#set ($currentColumn=3D1)
- #displayAttributeInCanvas ($myOnHoldExpirationDate 2)
+ #displayAttributeInCanvas ($myOnHoldExpirationDate 2 true)
</td></tr>
#end=20
</table>
@@ -331,7 +331,7 @@
#elseif ($att.equals($myOnHoldExpirationDate))
## Discard the ExpirationDate
#else
- #displayAttributeInCanvas ($att 1)
+ #displayAttributeInCanvas ($att 1 $group.isEditable4User($us=
er))
#end
#end
</td></tr>
------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3D3577&dsMessageId=3D3=
030481