* finished Issue 26: Auditing access to file revisions
git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@161 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
parent
5d2ff06b8d
commit
927f034c10
@ -84,6 +84,15 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def self.access_grouped(revision_id)
|
||||
sql = "select user_id, count(*), min(created_at), max(created_at) from #{DmsfFileRevisionAccess.table_name} where dmsf_file_revision_id = ? group by user_id"
|
||||
self.connection.execute(self.sanitize_sql_array([sql, revision_id]))
|
||||
end
|
||||
|
||||
def access_grouped
|
||||
DmsfFileRevision.access_grouped(self.id)
|
||||
end
|
||||
|
||||
def version
|
||||
"#{self.major_version}.#{self.minor_version}"
|
||||
end
|
||||
|
||||
@ -9,18 +9,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @revision.access_grouped.each do |access| %>
|
||||
<tr>
|
||||
<td>Row 1 Data 1</td>
|
||||
<td>Row 1 Data 2</td>
|
||||
<td>qqq</td>
|
||||
<td>www</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Row 2 Data 1</td>
|
||||
<td>Row 2 Data 2</td>
|
||||
<td>aaa</td>
|
||||
<td>sss</td>
|
||||
<td><%=h(User.find(access[0]))%></td>
|
||||
<td><%=access[1]%></td>
|
||||
<td><%=Time.parse(access[2]).to_s(:db)%></td>
|
||||
<td><%=Time.parse(access[3]).to_s(:db)%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user