1. I have created/defined a new group role @ admin/config/group/roles
2. I get the following error when I try to edit the new group role:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/drupal_7.12_group_1/includes/common.inc:2607) in drupal_send_headers() (line 1243 of /var/www/drupal_7.12_group_1/includes/bootstrap.inc).

and a page not found error. Also I have no way to delete the new group role.

I have installed and enabled the following modules:
og-7.x-2.x-dev
entityreference-7.x-1.x-dev
views_bulk_operations-7.x-3.x-dev

I do not have any other "og" related modules installed. Is anybody else having/seeing this problem?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Is it happening on a clean Drupal installation?

marshallexcavating’s picture

FileSize
68.28 KB

I just built a clean standard Drupal 7.12 installation on my localhost with just the basic modules need for "og". I have the same bug (cant edit or delete a role).

modules installed for this test:
drupal-7.12
entity-7.x-1.0-rc1
views_bulk_operations-7.x-3.x-dev
entityreference-7.x-1.x-dev
og-7.x-2.x-dev
ctools-7.x-1.0-rc1
views-7.x-3.3

The attached file sows the error I get when I try to edit a role.

Thanks

amitaibu’s picture

Assigned: Unassigned » amitaibu

Ok, I see the problem, I'll be working on a fix.

head’s picture

The same problem.

drupal-7.12
Views 7.x-3.3
Views Bulk Operations 7.x-3.0-rc1+3-dev
Chaos tools 7.x-1.0-rc1+117-dev
Entity API 7.x-1.0-rc1+42-dev
Entity Reference 7.x-1.0-beta5+0-dev
Organic groups 7.x-2.0-alpha1+18-dev

itamar’s picture

Component: og.module » og-ui
Status: Active » Needs review
FileSize
13.67 KB

Patch fixes roles UI paths + moving access validation from og_ui_admin_roles() to access callbacks.

itamar’s picture

FileSize
12.9 KB

Cleaning up my previous patch.

marshallexcavating’s picture

I attempted the patches to "og-7.x-2.x-dev" with "1463546-roles-ui-6.patch" and I got/failed:

"1 out of 6 hunks FAILED -- saving rejects to file og_ui/og_ui.module.rej"

I was able to manually change the 1 hunks and test; this leads me to believe that I should be trying to patch/test "Organic groups 7.x-2.0-alpha" or other? I am not sure if I am patching the intended og module base code please confirm?

Anyhow I tested the patch I out lined above and when I edit the role it takes me back to Home » Administration » Configuration with out any errors.

My test On a clean Drupal install not working.

Thanks

amitaibu’s picture

@marshallexcavating,
I was able to apply properly. Make sure your 2.x branch is up-to-date (git pull) and use git apply to apply the patch.

itamar’s picture

FileSize
21.32 KB

Enhancing previous patch: Applying same URLs logic to roles and permissions editing + Further clean-ups.

amitaibu’s picture

Status: Needs review » Needs work
FileSize
29.69 KB

- Can't edit permissions of per-entity roles (404 error) on group/node/[nid]/admin/permission/[rid]/edit
- Links should be hidden when editing single role/ single permissions (see image)
- Improve title callback, to make it clear on which context we are

itamar’s picture

FileSize
24.88 KB

Fixing issues according to comment #10 + Updating permissions test with the new URLs.

amitaibu’s picture

Status: Needs work » Needs review
marshallexcavating’s picture

Applied the patch "1463546-roles-ui-11.patch" to branch "Organic groups 7.x-2.0-alpha1+19-dev (2012-Mar-04)" on a clean install and roles are working as expected.

My tests indicate it is fixed.

One side note: on a new clean install before any content type is set to a group and you try to edit a role you can't (you get looped back to Home » Administration » Configuration). This is not a problem as soon as you set a content type to og the first time.

Working og modules for this test:
Drupal core 7.12
Chaos tool suite (ctools) 7.x-1.0-rc1
Entity reference 7.x-1.0-beta5+0-dev (2012-Feb-26)
Organic groups 7.x-2.0-alpha1+19-dev (2012-Mar-04)
Views Bulk Operations (VBO) 7.x-3.0-rc1+3-dev (2012-Feb-22)
Views 7.x-3.3

Thank you

amitaibu’s picture

Status: Needs review » Needs work

Getting very close

+++ b/og_ui/og_ui.admin.incundefined
@@ -242,64 +242,38 @@ function og_ui_admin_account($group_type, $gid) {
+    // If rid is given, load bundle and type from the role.

Maybe better: "Get group type and bundle from role."

+++ b/og_ui/og_ui.admin.incundefined
@@ -470,57 +456,86 @@ function theme_og_ui_admin_new_role($variables) {
+ * Retrieve roles.

Helper function to get role names.

+++ b/og_ui/og_ui.admin.incundefined
@@ -470,57 +456,86 @@ function theme_og_ui_admin_new_role($variables) {
+function og_ui_get_role_names($group_type, $gid, $bundle, $rid) {

I think it's a very custom function, lets prefix it with _ (i.e. function _og_ui...)

+++ b/og_ui/og_ui.admin.incundefined
@@ -470,57 +456,86 @@ function theme_og_ui_admin_new_role($variables) {
+    if ($group && og_is_group($group_type, $group)) {

At this point we shouldn't be getting wrong data, so we don't need to check again of the group was properly loaded.

+++ b/og_ui/og_ui.admin.incundefined
@@ -470,57 +456,86 @@ function theme_og_ui_admin_new_role($variables) {
+ * @param $form
+ * @param $form_state

No need to document these two variables.

+++ b/og_ui/og_ui.admin.incundefined
@@ -470,57 +456,86 @@ function theme_og_ui_admin_new_role($variables) {
+ *  Role ID. When specified, edit only this role's permissions.

Missing space in start of line.

+++ b/og_ui/og_ui.admin.incundefined
@@ -470,57 +456,86 @@ function theme_og_ui_admin_new_role($variables) {
+  // If rid is given, load bundle and type from the role.

Same as one of the previous comments.

+++ b/og_ui/og_ui.moduleundefined
@@ -71,26 +71,42 @@ function og_ui_menu() {
+    'page arguments' => array('og_ui_admin_roles', 1, 2, '', 5),

Please document why we pass an empty string.

+++ b/og_ui/og_ui.moduleundefined
@@ -130,12 +146,33 @@ function og_ui_menu() {
+    'title arguments' => array('OG @type - @bundle permissions', 4, 5),
+    'title callback' => 'og_ui_menu_bundle_roles_title_callback',

Fox consistency, please move the "title callback" above "title arguments".

+++ b/og_ui/og_ui.moduleundefined
@@ -200,26 +265,107 @@ function og_ui_user_access_group($perm, $group_type, $gid) {
+ * Menu access; Check permissions bundle editing.

bundle => per-bundle

+++ b/og_ui/og_ui.moduleundefined
@@ -200,26 +265,107 @@ function og_ui_user_access_group($perm, $group_type, $gid) {
+  if (!$role) {
+    return FALSE;
+  }
+

you can short it by return $role;

+++ b/og_ui/og_ui.moduleundefined
@@ -200,26 +265,107 @@ function og_ui_user_access_group($perm, $group_type, $gid) {
+    return FALSE;

Add docs -- // Role doesn't exist, or doesn't belong to the group.

+++ b/og_ui/og_ui.moduleundefined
@@ -254,6 +400,33 @@ function og_ui_menu_title_callback($title, $entity_type, $etid) {
+ * Title callback; Return the title of a group bundle

Maybe better: Return the title for editing role or permissions, based on context.

+++ b/og_ui/og_ui.moduleundefined
@@ -254,6 +400,33 @@ function og_ui_menu_title_callback($title, $entity_type, $etid) {
+      $title = str_replace('@bundle', 'Global', $title);

t('Global')

+++ b/og_ui/og_ui.moduleundefined
@@ -254,6 +400,33 @@ function og_ui_menu_title_callback($title, $entity_type, $etid) {
+    $title = str_replace('@role', $role->name, $title);

XSS... need to check_plain($role->name);

+++ b/og_ui/og_ui.moduleundefined
@@ -254,6 +400,33 @@ function og_ui_menu_title_callback($title, $entity_type, $etid) {
+  if (array_key_exists('label', $entity_info)) {

better use !empty() instead of array_key_exists().

+++ b/og_ui/og_ui.moduleundefined
@@ -254,6 +400,33 @@ function og_ui_menu_title_callback($title, $entity_type, $etid) {
+    $title = str_replace('@type', $entity_info['label'], $title);
+    $title = str_replace('@bundle', $entity_info['bundles'][$bundle]['label'], $title);

Again, need to check_plain() the $entity_info[...

gmclelland’s picture

Just tested patch in #11. It fixes the problem.

itamar’s picture

Status: Needs work » Needs review
FileSize
25.88 KB

Amending patch according to comment #14 + Fixing wrong title when editing bundle's role.

amitaibu’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.