Problem with field groups

Matt V. - February 21, 2007 - 17:13
Project:CCK Field Permissions
Version:5.x-1.10
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

I created a new field that I only wanted to show for a certain group of users. I installed the module, enabled the module, enabled the cck node type I wanted to control, chose the field I wanted to limit, then enabled all permissions for the particular group I wanted to have editing that particular field. However, when I logged in as a user in one of the other groups, the field still displayed. What am I missing?

#1

dzynz - February 22, 2007 - 19:01

I also have this problem with 5.1. CCK perms also give me sql errors.

#2

horizens - February 25, 2007 - 02:39
Version:4.7.x-1.1» 5.x-1.4

I too am having problems with the fields showing even though I set up everything correctly. I'm using 5.1.

#3

horizens - February 25, 2007 - 03:06

Oh, I think I found part of the problem. I'm trying to hide the field in a view. If the content type is on it's own then it works fine. Is there a work around?

#4

arthurf - February 25, 2007 - 05:23
Status:active» fixed

5.1.5 should fix this issue, please update to this version.

#5

arthurf - February 25, 2007 - 05:27

woops, make that 5.1.6

#6

sanyi - February 28, 2007 - 02:21
Version:5.x-1.4» 5.x-1.7

I am not sure if this is fixed or not. I made 2 fields,only 1 is viewable by guest which i set admin/user/access
Then I logout and I could still see 2 fields.

#7

sanyi - March 4, 2007 - 04:35
Status:fixed» active

The status shows that its fixed, I redownload the whole pakage and it is still not working for me. So, I set it back to active. I am sorry if it has been fixed.

#8

sanyi - March 6, 2007 - 23:59
Version:5.x-1.7» 5.x-1.8

still does not work using version 5.x-1.8

#9

nurlan.bayaman - March 7, 2007 - 17:25

Confirm.
Fields sill showing. Though, fields are hidden while editing a form.

Module version is 5.x-1.8

#10

bchoc - March 8, 2007 - 06:44

Another concurrence. I can block field write permissions, but not read permissions. 5.1, 1.8.

#11

Jensor - March 8, 2007 - 11:53

Confirm, the problem is still active.

#12

nurlan.bayaman - March 10, 2007 - 18:02

Pls fix it ^^ :)

#13

gaele - March 12, 2007 - 22:03
Category:support request» bug report
Priority:normal» critical

Confirmed. Right now the module doesn't do what it's supposed to do.

#14

oprior - March 13, 2007 - 18:34

It's not working for me either.

Question: can I safely rollback to the previous version?

#15

nurlan.bayaman - March 14, 2007 - 15:25

Which version does work?

#16

munga - March 15, 2007 - 00:18

Ok, This bug is annoying a lot. I had a look at the code but I'm a bit lost.

as far as I understand the problem should be in the function cck_field_perms_nodeapi
but it seems that this function is never called (I just tried to print something at the beginning
of the function). Can anybody give me a quick explanation of how this module is supposed
to restrict visibility of a certain field ?

cheers.

#17

huayen - March 15, 2007 - 17:28

I am using 5.x-1.8 on two of my sites, one is working, but the other has the same problem as discussed here. I am really confused why this happen. Hope this problem will be solved soon.

#18

nurlan.bayaman - March 19, 2007 - 20:58

huayen, which modules do you use on "working" site? And which ones on another?

#19

munga - March 22, 2007 - 08:15

The problem is in cck_field_perms_nodeapi

foreach ($disallowed_fields[$type] as $disallowed_field) {

should be

foreach ($disallowed_fields[$type] as $disallowed_field => $a) {

or something similar as _cfp_content_to_readable is interested only about the keys and not the values
of the array. I think the same goes for _cfp_form_helper

If this works I'll roll a proper patch.

#20

freeman - March 24, 2007 - 14:49

Tried the " => $a" suggested in comment #19, doesn't work for me. I'm running v1.8 on a pretty new test site with 5.1.

#21

1st-angel - March 24, 2007 - 16:13

hi,
you have to change the line from
foreach ($disallowed_fields[$type] as $disallowed_field){
to
foreach ($disallowed_fields[$type] as $disallowed_field => $value){
and add a line
if($value==0){continue;}
as the first statement inside the block.
The whole block than looks like this:

foreach ($disallowed_fields[$type] as $disallowed_field => $value) {
            if($value==0){continue;}
            if (!(user_access(_cfp_content_to_readable($type, $disallowed_field, "view")))){    
              unset($node->$disallowed_field);
              unset($node->content[$disallowed_field]);       
            }  
          }

#22

freeman - March 25, 2007 - 06:32

Thanks, it works. I've also amended the similar snippet in the _cfp_form_helper function - so the edit forms work as well. Nice.

#23

munga - March 25, 2007 - 23:20
Component:Miscellaneous» Code
Status:active» patch (code needs review)

the patch.

AttachmentSize
cck_field_perms.module.patch.txt1.86 KB

#24

ac - April 5, 2007 - 07:03

patch applies and works with 5--1-8. Please commit.
Thanks

#25

Jensor - April 11, 2007 - 13:01

Patch works for me too, thanks.

#26

oprior - April 11, 2007 - 18:08

Thanks everyone, can we get a new release for all us Noobs who can't apply patches?

#27

jarea - April 14, 2007 - 18:01

I just added the patch to 1.8. I have a CCK field that is a set of radio buttons. Turned off the view field permission (and all other permissions) for anonymous and registered users and then tried to add a node. The field still shows up and can be modified.

#28

jarea - April 14, 2007 - 18:23

Sorry - cancel that last comment. I had just made the edit suggested a couple of posts back and not applied the entire patch. Applied the full patch and all seems to work fine now.

Thanks!

#29

Ryan Palmer - April 21, 2007 - 23:34

After applying the patch, I am still having the same issue.

All related modules are the most recent versions... I cant find any other reason for this not to be working!

#30

Cayenne - April 24, 2007 - 17:29

Same problem here. Manually applied patch and am getting unauthorized view of textfields with phone numbers and the like.

If there's anything an amateur can do to help, please let us know!

#31

Cayenne - April 25, 2007 - 02:41
Title:field still showing for all users» Workaround for My Site: It works well enough

After starting with a simple one-field node type, I discovered the following:

Using the patches above, I was able to get the module to work when APPLIED TO FIELDS OUTSIDE A GROUP.

The fields I wanted to hide, I simply moved out of a group and used the weights to get them in the proper order. Not perfect, but it works enough for me.

Still hoping for a total fix!

#32

yched - April 25, 2007 - 07:23
Title:Workaround for My Site: It works well enough» field still showing for all users

Maybe related to the fieldgroup stuff - we committed this in latest -dev CCK a few days ago.
I had second thoughts afterwards, but for now it's still in.

+ when you change a title in the issue queue, it changes the title of the whole thread :-)

#33

arthurf - May 2, 2007 - 02:41
Status:patch (code needs review)» fixed

Patch from munga has been applied, along with some code cleanup. I hope to resolve some of the issues with field groups, however because field groups have changed over time with CCK, my aim is only going to be on the latest CCK versions.

#34

neurojavi - May 11, 2007 - 19:24
Version:5.x-1.8» 5.x-1.9

Hi:

I've downloaded, installed an properly configured the last version of the module (5.x.1.10) (not available in the version box yet :-( )
And it seems to do nothing... All roles (included anonymous) can see the restricted fields and roles with edit permissions can see and edit fields.
I have all checkboxes in the module section of admin/user/access disabled, so in theory, only superadmin could see the fields...
This version seems to have the patch from munga applied but it doesn't seem to work for me.
Anybody else?

Many thanks.-

#35

arthurf - May 12, 2007 - 12:34

Hi neurojavi-

Can you send me a screen shot of your admin/user/access screen for cck_field_perms? I ask because I'm using it without the experience that you're describing here.

thanks

#36

neurojavi - May 12, 2007 - 22:36

Hi:

Here is the screenshot

Thanks.-

AttachmentSize
cck_field_perms.png120.25 KB

#37

Jensor - May 13, 2007 - 08:30

I had to confirm the problem too.

The new Version 5.x-1.10 doesn't work for me too. I will use the 5.x-1.8 with the patch, till the problem is solved.

#38

arthurf - May 16, 2007 - 16:22
Status:fixed» active (needs more info)

What version of CCK are you using? I've been testing against 1-4, but I haven't tested against 1-5 yet which maybe the source of the issue?

#39

arthurf - May 17, 2007 - 01:13
Version:5.x-1.9» 5.x-1.10

also, can you let me know if you have the field group module on?

#40

neurojavi - May 21, 2007 - 16:05

Hi arthurf:

I'm using cck-5.x-1.5 and the field group module is DISABLED.

Hope this helps...

Javi.-

#41

arthurf - May 21, 2007 - 16:09

Can you try turning on the field group module? I think that I have to require the field group module to make things work.

#42

neurojavi - May 21, 2007 - 16:23

Hi:

I've enabled the field group module and doesn't appear to be any change.
I'm still seeing the fields with a user without any permissions to see those fields.

Thanks.-

#43

neurojavi - May 25, 2007 - 19:08
Status:active (needs more info)» active

just changing state...

#44

walterhoct - June 13, 2007 - 14:52
Title:field still showing for all users» Problem with field groups

With the latest version(5.x-1.10), the access control for each individual field seems fine. However, it doesn't work when I tried to hide a complete group without checking each individual field. Not the way it's supposed to work, with the text "Checking this box will hide this complete field group" under the checkbox for the group.
This is definitely a very useful and powerful module. But the defect is not minor.
Any plan to fix this bug?

#45

mornel - June 21, 2007 - 14:08

well I played around w/ group issue. It seems that the problem is that if at least one filed from a particular group is hidden the whole group will not be displayed. Check the 404 line in /modules/cck/fieldgroup.module. For now I've commented this part from 404 to 407...

Hope this will guide you to proper patch ;)

#46

samlogan - November 26, 2007 - 11:22

Did anyone resolve this issue yet?

Thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.