...
-
-
-A **Group** represents...
+A **Group** represents a set of objects. Groups allow you to organize content, define user roles, and apply permissions to sets of objects.
h2. Methods
table(table table-bordered table-condensed).
|_. Attribute|_. Type|_. Description|_. Example|
|name|string|||
+|group_class|string|Type of group. This does not affect behavior, but determines how the group is presented in the user interface.|@folder@|
|description|text|||
|updated_at|datetime|||
api_accessible :user, extend: :common do |t|
t.add :name
+ t.add :group_class
t.add :description
end
end
--- /dev/null
+class AddGroupClassToGroups < ActiveRecord::Migration
+ def change
+ add_column :groups, :group_class, :string
+ add_index :groups, :group_class
+ end
+end
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140407184311) do
+ActiveRecord::Schema.define(:version => 20140421140924) do
create_table "api_client_authorizations", :force => true do |t|
t.string "api_token", :null => false
t.string "name"
t.text "description"
t.datetime "updated_at", :null => false
+ t.string "group_class"
end
add_index "groups", ["created_at"], :name => "index_groups_on_created_at"
+ add_index "groups", ["group_class"], :name => "index_groups_on_group_class"
add_index "groups", ["modified_at"], :name => "index_groups_on_modified_at"
add_index "groups", ["uuid"], :name => "index_groups_on_uuid", :unique => true
uuid: zzzzz-j7d0g-48foin4vonvc2at
owner_uuid: zzzzz-tpzed-000000000000000
name: Administrators of a subset of users
+
+afolder:
+ uuid: zzzzz-j7d0g-v955i6s2oi1cbso
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ name: A Folder
+ description: Test folder belonging to active user
+ group_class: folder
+
+asubfolder:
+ uuid: zzzzz-j7d0g-axqo7eu9pwvna1x
+ owner_uuid: zzzzz-j7d0g-v955i6s2oi1cbso
+ name: A Subfolder
+ description: Test folder belonging to active user's first test folder
+ group_class: folder
assert_response 403
end
+ test "get list of folders" do
+ authorize_with :active
+ get :index, filters: [['group_class', '=', 'folder']], format: :json
+ assert_response :success
+ group_uuids = []
+ jresponse['items'].each do |group|
+ assert_equal 'folder', group['group_class']
+ group_uuids << group['uuid']
+ end
+ assert_not_nil group_uuids.index groups(:afolder).uuid
+ assert_not_nil group_uuids.index groups(:asubfolder).uuid
+ end
+
end
self.request.headers["Accept"] = "text/json"
end
+ def jresponse
+ @jresponse ||= ActiveSupport::JSON.decode @response.body
+ end
+
def authorize_with(api_client_auth_name)
self.request.env['HTTP_AUTHORIZATION'] = "OAuth2 #{api_client_authorizations(api_client_auth_name).api_token}"
end
end
class ActionDispatch::IntegrationTest
- def jresponse
- @jresponse ||= ActiveSupport::JSON.decode @response.body
- end
def auth auth_fixture
{'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(auth_fixture).api_token}"}
end