Starting implementation of Permission models (very early commit)
This commit is contained in:
parent
86ffcc09a9
commit
c6045b0028
@ -1,6 +1,7 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -17,7 +18,6 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class DmsfLock < ActiveRecord::Base
|
||||
# unloadable
|
||||
before_create :generate_uuid
|
||||
belongs_to :file, :class_name => "DmsfFile", :foreign_key => "entity_id"
|
||||
belongs_to :folder, :class_name => "DmsfFolder", :foreign_key => "entity_id"
|
||||
|
||||
22
app/models/dmsf_permission.rb
Normal file
22
app/models/dmsf_permission.rb
Normal file
@ -0,0 +1,22 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class DmsfPermission < ActiveRecord::Base
|
||||
as_enum :scope, [:SCOPE_WRITE, :SCOPE_READ, :SCOPE_MODIFY, :SCOPE_LOCK, :SCOPE]
|
||||
end
|
||||
0
test/fixtures/dmsf_permissions.yml
vendored
Normal file
0
test/fixtures/dmsf_permissions.yml
vendored
Normal file
26
test/unit/dmsf_permission_test.rb
Normal file
26
test/unit/dmsf_permission_test.rb
Normal file
@ -0,0 +1,26 @@
|
||||
require File.expand_path('../../test_helper.rb', __FILE__)
|
||||
|
||||
class DmsfPermissionTest < RedmineDmsf::Test::UnitTest
|
||||
attr_reader :perm
|
||||
fixtures :projects, :users, :dmsf_folders, :dmsf_files, :dmsf_file_revisions,
|
||||
:roles, :members, :member_roles, :enabled_modules, :enumerations
|
||||
|
||||
def setup
|
||||
end
|
||||
|
||||
test "Static values compute" do
|
||||
assert_equal 1, DmsfPermission::READ #Read / Browse
|
||||
assert_equal 2, DmsfPermission::WRITE #Write (new file / owned file)
|
||||
assert_equal 4, DmsfPermission::MODIFY #Modify existing file/folder - create revision
|
||||
assert_equal 8, DmsfPermission::LOCK #Ability to lock/unlock
|
||||
|
||||
assert_equal 7, DmsfPermission::MODIFY | DmsfPermission::WRITE | DmsfPermission::READ
|
||||
end
|
||||
|
||||
test "create" do
|
||||
|
||||
# DmsfPermission
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user