{"action":"created","comment":{"url":"https://api.github.com/repos/qor/qor/pulls/comments/46233818","id":46233818,"diff_hunk":"@@ -436,3 +465,157 @@ func (res *Resource) allowedMetas(attrs []*Meta, context *Context, roles ...role\n \t}\n \treturn metas\n }\n+\n+func (res *Resource) allowedMetas1(sections []*Section, context *Context, roles ...roles.PermissionMode) []*Section {\n+\tfor _, section := range sections {\n+\t\tvar editableRows [][]string\n+\t\tfor _, row := range section.Columns {\n+\t\t\tvar editableColumns []string\n+\t\t\tfor _, column := range row {\n+\t\t\t\tfor _, role := range roles {\n+\t\t\t\t\tmeta := res.GetMeta(column)\n+\t\t\t\t\tif true || (meta != nil && meta.HasPermission(role, context.Context)) {\n+\t\t\t\t\t\teditableColumns = append(editableColumns, column)\n+\t\t\t\t\t\tbreak\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tif len(editableColumns) > 0 {\n+\t\t\t\teditableRows = append(editableRows, editableColumns)\n+\t\t\t}\n+\t\t}\n+\t\tsection.Columns = editableRows\n+\t}\n+\treturn sections\n+}\n+\n+// Section Related Methods\n+func appendSectionFromStrings(columns []string) []*Section {\n+\tvar sections []*Section\n+\tfor _, column := range columns {\n+\t\tsections = append(sections, &Section{Columns: [][]string{{column}}})\n+\t}\n+\treturn sections\n+}\n+\n+func appendSectionFromInterfaces(values ...interface{}) []*Section {\n+\tvar sections []*Section\n+\tvar hasColumns []string\n+\tvar excludedColumns []string\n+\tvalueSize := len(values)\n+\tfor i := 0; i < len(values); i++ {\n+\t\tvalue := values[valueSize-i-1]\n+\t\tif section, ok := value.(*Section); ok {\n+\t\t\tsections = append(sections, uniqueSection(section, hasColumns))\n+\t\t} else if column, ok := value.(string); ok {\n+\t\t\tif strings.HasPrefix(column, \"-\") {\n+\t\t\t\texcludedColumns = append(excludedColumns, column)\n+\t\t\t} else {","path":"admin/resource.go","position":228,"original_position":228,"commit_id":"8a52d56d3780957e9771248a2add39553abcb566","original_commit_id":"8a52d56d3780957e9771248a2add39553abcb566","user":{"login":"jinzhu","id":6843,"avatar_url":"https://avatars.githubusercontent.com/u/6843?v=3","gravatar_id":"","url":"https://api.github.com/users/jinzhu","html_url":"https://github.com/jinzhu","followers_url":"https://api.github.com/users/jinzhu/followers","following_url":"https://api.github.com/users/jinzhu/following{/other_user}","gists_url":"https://api.github.com/users/jinzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/jinzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinzhu/subscriptions","organizations_url":"https://api.github.com/users/jinzhu/orgs","repos_url":"https://api.github.com/users/jinzhu/repos","events_url":"https://api.github.com/users/jinzhu/events{/privacy}","received_events_url":"https://api.github.com/users/jinzhu/received_events","type":"User","site_admin":false},"body":"} else if {","created_at":"2015-12-01T02:28:34Z","updated_at":"2015-12-01T02:28:34Z","html_url":"https://github.com/qor/qor/pull/115#discussion_r46233818","pull_request_url":"https://api.github.com/repos/qor/qor/pulls/115","_links":{"self":{"href":"https://api.github.com/repos/qor/qor/pulls/comments/46233818"},"html":{"href":"https://github.com/qor/qor/pull/115#discussion_r46233818"},"pull_request":{"href":"https://api.github.com/repos/qor/qor/pulls/115"}}},"pull_request":{"url":"https://api.github.com/repos/qor/qor/pulls/115","id":52206771,"html_url":"https://github.com/qor/qor/pull/115","diff_url":"https://github.com/qor/qor/pull/115.diff","patch_url":"https://github.com/qor/qor/pull/115.patch","issue_url":"https://api.github.com/repos/qor/qor/issues/115","number":115,"state":"open","locked":false,"title":"Section PR","user":{"login":"jinzhu","id":6843,"avatar_url":"https://avatars.githubusercontent.com/u/6843?v=3","gravatar_id":"","url":"https://api.github.com/users/jinzhu","html_url":"https://github.com/jinzhu","followers_url":"https://api.github.com/users/jinzhu/followers","following_url":"https://api.github.com/users/jinzhu/following{/other_user}","gists_url":"https://api.github.com/users/jinzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/jinzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinzhu/subscriptions","organizations_url":"https://api.github.com/users/jinzhu/orgs","repos_url":"https://api.github.com/users/jinzhu/repos","events_url":"https://api.github.com/users/jinzhu/events{/privacy}","received_events_url":"https://api.github.com/users/jinzhu/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-01T02:00:32Z","updated_at":"2015-12-01T02:28:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2003991eb69e21b0b5c725785732e7c85dc4e20b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/qor/qor/pulls/115/commits","review_comments_url":"https://api.github.com/repos/qor/qor/pulls/115/comments","review_comment_url":"https://api.github.com/repos/qor/qor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qor/qor/issues/115/comments","statuses_url":"https://api.github.com/repos/qor/qor/statuses/8a52d56d3780957e9771248a2add39553abcb566","head":{"label":"qor:section","ref":"section","sha":"8a52d56d3780957e9771248a2add39553abcb566","user":{"login":"qor","id":1917300,"avatar_url":"https://avatars.githubusercontent.com/u/1917300?v=3","gravatar_id":"","url":"https://api.github.com/users/qor","html_url":"https://github.com/qor","followers_url":"https://api.github.com/users/qor/followers","following_url":"https://api.github.com/users/qor/following{/other_user}","gists_url":"https://api.github.com/users/qor/gists{/gist_id}","starred_url":"https://api.github.com/users/qor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qor/subscriptions","organizations_url":"https://api.github.com/users/qor/orgs","repos_url":"https://api.github.com/users/qor/repos","events_url":"https://api.github.com/users/qor/events{/privacy}","received_events_url":"https://api.github.com/users/qor/received_events","type":"Organization","site_admin":false},"repo":{"id":20549706,"name":"qor","full_name":"qor/qor","owner":{"login":"qor","id":1917300,"avatar_url":"https://avatars.githubusercontent.com/u/1917300?v=3","gravatar_id":"","url":"https://api.github.com/users/qor","html_url":"https://github.com/qor","followers_url":"https://api.github.com/users/qor/followers","following_url":"https://api.github.com/users/qor/following{/other_user}","gists_url":"https://api.github.com/users/qor/gists{/gist_id}","starred_url":"https://api.github.com/users/qor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qor/subscriptions","organizations_url":"https://api.github.com/users/qor/orgs","repos_url":"https://api.github.com/users/qor/repos","events_url":"https://api.github.com/users/qor/events{/privacy}","received_events_url":"https://api.github.com/users/qor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qor/qor","description":"QOR is a set of libraries written in Go that abstracts common features needed for business applications, CMSs, and E-commerce systems.","fork":false,"url":"https://api.github.com/repos/qor/qor","forks_url":"https://api.github.com/repos/qor/qor/forks","keys_url":"https://api.github.com/repos/qor/qor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qor/qor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qor/qor/teams","hooks_url":"https://api.github.com/repos/qor/qor/hooks","issue_events_url":"https://api.github.com/repos/qor/qor/issues/events{/number}","events_url":"https://api.github.com/repos/qor/qor/events","assignees_url":"https://api.github.com/repos/qor/qor/assignees{/user}","branches_url":"https://api.github.com/repos/qor/qor/branches{/branch}","tags_url":"https://api.github.com/repos/qor/qor/tags","blobs_url":"https://api.github.com/repos/qor/qor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qor/qor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qor/qor/git/refs{/sha}","trees_url":"https://api.github.com/repos/qor/qor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qor/qor/statuses/{sha}","languages_url":"https://api.github.com/repos/qor/qor/languages","stargazers_url":"https://api.github.com/repos/qor/qor/stargazers","contributors_url":"https://api.github.com/repos/qor/qor/contributors","subscribers_url":"https://api.github.com/repos/qor/qor/subscribers","subscription_url":"https://api.github.com/repos/qor/qor/subscription","commits_url":"https://api.github.com/repos/qor/qor/commits{/sha}","git_commits_url":"https://api.github.com/repos/qor/qor/git/commits{/sha}","comments_url":"https://api.github.com/repos/qor/qor/comments{/number}","issue_comment_url":"https://api.github.com/repos/qor/qor/issues/comments{/number}","contents_url":"https://api.github.com/repos/qor/qor/contents/{+path}","compare_url":"https://api.github.com/repos/qor/qor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qor/qor/merges","archive_url":"https://api.github.com/repos/qor/qor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qor/qor/downloads","issues_url":"https://api.github.com/repos/qor/qor/issues{/number}","pulls_url":"https://api.github.com/repos/qor/qor/pulls{/number}","milestones_url":"https://api.github.com/repos/qor/qor/milestones{/number}","notifications_url":"https://api.github.com/repos/qor/qor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qor/qor/labels{/name}","releases_url":"https://api.github.com/repos/qor/qor/releases{/id}","created_at":"2014-06-06T03:06:46Z","updated_at":"2015-11-30T09:44:08Z","pushed_at":"2015-12-01T02:00:32Z","git_url":"git://github.com/qor/qor.git","ssh_url":"git@github.com:qor/qor.git","clone_url":"https://github.com/qor/qor.git","svn_url":"https://github.com/qor/qor","homepage":"http://getqor.com/","size":21859,"stargazers_count":817,"watchers_count":817,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":17,"forks":80,"open_issues":17,"watchers":817,"default_branch":"master"}},"base":{"label":"qor:master","ref":"master","sha":"3d1f01a02b396de76c833829cd1ff6625c39f5f1","user":{"login":"qor","id":1917300,"avatar_url":"https://avatars.githubusercontent.com/u/1917300?v=3","gravatar_id":"","url":"https://api.github.com/users/qor","html_url":"https://github.com/qor","followers_url":"https://api.github.com/users/qor/followers","following_url":"https://api.github.com/users/qor/following{/other_user}","gists_url":"https://api.github.com/users/qor/gists{/gist_id}","starred_url":"https://api.github.com/users/qor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qor/subscriptions","organizations_url":"https://api.github.com/users/qor/orgs","repos_url":"https://api.github.com/users/qor/repos","events_url":"https://api.github.com/users/qor/events{/privacy}","received_events_url":"https://api.github.com/users/qor/received_events","type":"Organization","site_admin":false},"repo":{"id":20549706,"name":"qor","full_name":"qor/qor","owner":{"login":"qor","id":1917300,"avatar_url":"https://avatars.githubusercontent.com/u/1917300?v=3","gravatar_id":"","url":"https://api.github.com/users/qor","html_url":"https://github.com/qor","followers_url":"https://api.github.com/users/qor/followers","following_url":"https://api.github.com/users/qor/following{/other_user}","gists_url":"https://api.github.com/users/qor/gists{/gist_id}","starred_url":"https://api.github.com/users/qor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qor/subscriptions","organizations_url":"https://api.github.com/users/qor/orgs","repos_url":"https://api.github.com/users/qor/repos","events_url":"https://api.github.com/users/qor/events{/privacy}","received_events_url":"https://api.github.com/users/qor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qor/qor","description":"QOR is a set of libraries written in Go that abstracts common features needed for business applications, CMSs, and E-commerce systems.","fork":false,"url":"https://api.github.com/repos/qor/qor","forks_url":"https://api.github.com/repos/qor/qor/forks","keys_url":"https://api.github.com/repos/qor/qor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qor/qor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qor/qor/teams","hooks_url":"https://api.github.com/repos/qor/qor/hooks","issue_events_url":"https://api.github.com/repos/qor/qor/issues/events{/number}","events_url":"https://api.github.com/repos/qor/qor/events","assignees_url":"https://api.github.com/repos/qor/qor/assignees{/user}","branches_url":"https://api.github.com/repos/qor/qor/branches{/branch}","tags_url":"https://api.github.com/repos/qor/qor/tags","blobs_url":"https://api.github.com/repos/qor/qor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qor/qor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qor/qor/git/refs{/sha}","trees_url":"https://api.github.com/repos/qor/qor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qor/qor/statuses/{sha}","languages_url":"https://api.github.com/repos/qor/qor/languages","stargazers_url":"https://api.github.com/repos/qor/qor/stargazers","contributors_url":"https://api.github.com/repos/qor/qor/contributors","subscribers_url":"https://api.github.com/repos/qor/qor/subscribers","subscription_url":"https://api.github.com/repos/qor/qor/subscription","commits_url":"https://api.github.com/repos/qor/qor/commits{/sha}","git_commits_url":"https://api.github.com/repos/qor/qor/git/commits{/sha}","comments_url":"https://api.github.com/repos/qor/qor/comments{/number}","issue_comment_url":"https://api.github.com/repos/qor/qor/issues/comments{/number}","contents_url":"https://api.github.com/repos/qor/qor/contents/{+path}","compare_url":"https://api.github.com/repos/qor/qor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qor/qor/merges","archive_url":"https://api.github.com/repos/qor/qor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qor/qor/downloads","issues_url":"https://api.github.com/repos/qor/qor/issues{/number}","pulls_url":"https://api.github.com/repos/qor/qor/pulls{/number}","milestones_url":"https://api.github.com/repos/qor/qor/milestones{/number}","notifications_url":"https://api.github.com/repos/qor/qor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qor/qor/labels{/name}","releases_url":"https://api.github.com/repos/qor/qor/releases{/id}","created_at":"2014-06-06T03:06:46Z","updated_at":"2015-11-30T09:44:08Z","pushed_at":"2015-12-01T02:00:32Z","git_url":"git://github.com/qor/qor.git","ssh_url":"git@github.com:qor/qor.git","clone_url":"https://github.com/qor/qor.git","svn_url":"https://github.com/qor/qor","homepage":"http://getqor.com/","size":21859,"stargazers_count":817,"watchers_count":817,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":17,"forks":80,"open_issues":17,"watchers":817,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qor/qor/pulls/115"},"html":{"href":"https://github.com/qor/qor/pull/115"},"issue":{"href":"https://api.github.com/repos/qor/qor/issues/115"},"comments":{"href":"https://api.github.com/repos/qor/qor/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/qor/qor/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/qor/qor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qor/qor/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/qor/qor/statuses/8a52d56d3780957e9771248a2add39553abcb566"}}}}