Download & Extend

Add a new user permission "Translate own nodes"

Project:Drupal core
Version:8.x-dev
Component:translation.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

There is currently only one assignable user permission for i8ns Translation module: "Translate nodes". Giving a user this permission makes the "Translation" tab appear for all translatable nodes. I would like to request the addition of a "Translate own nodes" permission which causes the "Translation" tab to show up only for those nodes owned by the user.

Comments

#1

In Drupal 6 it was easy, although I needed to change the core files. Here's the patch for it. There will "translate own content" - access right item at the admin side.

AttachmentSizeStatusTest resultOperations
translate-own-nodes.patch2.28 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch translate-own-nodes.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#2

Project:Internationalization» Drupal core
Version:5.x-2.3» 7.x-dev
Component:Miscellaneous» translation.module

Moving to correct project, Drupal core.

#3

Status:active» needs review

Attached is a D7 implementation of the patch from comment #1.

AttachmentSizeStatusTest resultOperations
jsomers_253157_1.patch2.79 KBIdlePassed: 11571 passes, 0 fails, 0 exceptionsView details | Re-test

#4

Status:needs review» reviewed & tested by the community

Looks good, but we may need a unit test case for this permission...

#5

Status:reviewed & tested by the community» needs work

Agreed with #4. Let's make sure we add some tests for this, and related functionality. Thanks!

#6

Status:needs work» needs review

Attached is a simple addition to the existing translation test. A new user is created and an attempt is made to translate a node which has not been created by that user.

Please let me know if a bigger test needs to be created or something else has to be added.

AttachmentSizeStatusTest resultOperations
jsomers_253157_2-D7.patch4.12 KBIdlePassed: 11823 passes, 0 fails, 0 exceptionsView details | Re-test

#7

Status:needs review» needs work

We should probably check for a 200 when they translate a node they do have permission to translate as well. Otherwise looks good.

#8

Version:7.x-dev» 8.x-dev

#9

If this is push to drupal 8 than is another 2 more years of waiting time. If each user wish to translate their own content will work better for a community, by restricting a site to a small group of trustworthy users to translate the whole community site is not very effective. Sorry i not a programmer but do hope that is can resolve. Thk!

#10

Wouldn't be possible to apply the patch on http://drupal.org/node/253157#comment-1153121 in D6 ??????

#13

I use #11 and global content translate premission is broken so all admin can't translate like what FiNeX say but using #12 got another problem, those with translate permission all turn user1 account when they try to translate node. Can someone confirm this or maybe i mess up the patch. Thank.

#14

@Spacereactor: what do you exactly mean with "all turn user1 account" ?

#15

I using manually patching your #11 and after that reset my user permission for content translate and own translate. when i user a normal account to login example user20, when i click translate node this user20 turn to user1.

#16

Probably you have some other issues on your setup: I've just tested the patch on a clean drupal installation and when I click on "translate node" the user doesn't change.
Moreover if you look at the source code of the patch you can see that it is just a check on the access control.

#17

I remove all other modules expect drupal 6.16, i18n, token, and views.

I have 4 roles, anonymous user, authenticated user, admin, contributor
Admin is set all user permissions to yes and Contributor is able to create node, edit own node, delete own node and translate own content.

I have 3 users,
user1=myself(super user)
user2=admin role
user3=contributor

After i create a new node with super user account(user1), logout from user1 and login as user3, see the node and can't translate, logout from user3 and login as user2 with admin role, user2 see the node and translate button, once click on the translate button, user2 automatic switch to user1. (something is not right here)

I use user3 with contributor role, create a new node, user1 and user2 can translate that own, but user3 can't translate own node. And when user2 try to translate the user3 node, it change to user1 when click on translate button.

Maybe i didn't apply the patch correct but this is what is getting from manual add patch #11

#18

i zip the translation.module and you can check if i mess up the manually patch.

AttachmentSizeStatusTest resultOperations
translation.module.zip5.1 KBIgnored: Check issue status.NoneNone

#19

+1

#20

I've done some extra testing and I've had your same problem... I'm trying to find the problem. Thanks

#21

Please, don't use the patch I've uploaded for D6: it doesn't work and has a critical security bug.

You can try using the first patch uploaded here: http://drupal.org/node/253157#comment-1153121

P.s: why the version of this bug has been set to D8 ???

#22

@FiNeX - your comments with the patches have been removed from this issue.

dokumori
Security Team coordinator

#23

Thanks @dokumori :-)

#24

I have found that all you have to do to remove translation tabs (and translation rights) from nodes that are not assigned to people (i.e. that are not theirs to edit) is to change the function _translation_tab_access in translation.module, adding there node_access control for updating. It should look like this:

<?php
function _translation_tab_access($node) {
  return !empty(
$node->language) && translation_supported_type($node->type) && node_access('view', $node) && node_access('update', $node) && user_access('translate content');
}
?>

This works well with Node Access User Reference.
PS. This goes for Drupal 6.19 + Internationalization 6.x-1.7

#25

Just a quick note for anyone else looking for this that it's been turned into a mini module http://drupal.org/project/translation_own_nodes.

#26

#27

Status:needs work» needs review

#1: translate-own-nodes.patch queued for re-testing.

#28

Status:needs review» needs work

The last submitted patch, translate_own_nodes.patch, failed testing.

nobody click here