Edit this team.

        :param str name: (required)
        :param str permission: (optional), ('pull', 'push', 'admin')
        :returns: bool
347728
def edit(self, name, permission=''):
        
        if name:
            data = {'name': name, 'permission': permission}
            json = self._json(self._patch(self._api, data=dumps(data)), 200)
            if json:
                self._update_(json)
                return True
        return False
1241752
def add_permission(self, role, name):
        
        if self.has_permission(role, name):
            return True
        targetGroup = AuthGroup.objects(role=role, creator=self.client).first()
        if not targetGroup:
            return False
        # Create or update
        permission = AuthPermission.objects(name=name).update(
                add_to_set__groups=[targetGroup], creator=self.client, upsert=True
        )
        return True
957403
public function editTeam(int $id, string $name, string $description = null,
                             string $permission = AbstractApi::PERMISSION_PULL): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id), Request::METHOD_PATCH, [
                'name'        => $name,
                'description' => $description,
                'permission'  => $permission
            ]);
    }
979212
def has_permission(self, request, *args, **kwargs):
        
        self.kwargs = kwargs
        self.args = args
        self.request = request
        self.org = self.derive_org()

        if self.get_user().is_superuser:
            return True

        if self.get_user().has_perm(self.permission):
            return True

        return self.has_org_perm(self.permission)
651826
def set(self, name, value, **kw):
        

        # check write permission
        sm = getSecurityManager()
        permission = permissions.ManagePortal
        if not sm.checkPermission(permission, self.context):
            raise Unauthorized("Not allowed to modify the Plone portal")

        # set the attribute
        if not hasattr(self.context, name):
            return False
        self.context[name] = value
        return True
1300456
def update(
            self, request, pk=None, parent_lookup_seedteam=None,
            parent_lookup_seedteam__organization=None):
        ''''''
        user = get_object_or_404(User, pk=pk)
        team = self.check_team_permissions(
            request, parent_lookup_seedteam,
            parent_lookup_seedteam__organization)
        team.users.add(user)
        return Response(status=status.HTTP_204_NO_CONTENT)
26070
def sharing?(permission_template:)
        wf = workflow(permission_template: permission_template)
        return false unless wf
        wf.allows_access_grant?
      end
180787
def edit(self, name, description=github.GithubObject.NotSet, permission=github.GithubObject.NotSet, privacy=github.GithubObject.NotSet):
        
        assert isinstance(name, (str, unicode)), name
        assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
        assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
        assert privacy is github.GithubObject.NotSet or isinstance(privacy, (str, unicode)), privacy
        post_parameters = {
            "name": name,
        }
        if description is not github.GithubObject.NotSet:
            post_parameters["description"] = description
        if permission is not github.GithubObject.NotSet:
            post_parameters["permission"] = permission
        if privacy is not github.GithubObject.NotSet:
            post_parameters["privacy"] = privacy
        headers, data = self._requester.requestJsonAndCheck(
            "PATCH",
            self.url,
            input=post_parameters
        )
        self._useAttributes(data)
454737
def has_permission(self, request, extra_permission=None):
        
        permission = request.user.is_active and request.user.is_staff
        if extra_permission:
            permission = permission and request.user.has_perm(extra_permission)
        return permission
316270
def get_collaborator_permission(self, collaborator):
        
        assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance(collaborator, (str, unicode)), collaborator
        if isinstance(collaborator, github.NamedUser.NamedUser):
            collaborator = collaborator._identity
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/collaborators/" + collaborator + "/permission",
        )
        return data["permission"]
410985
def permission_for_action(self, action):
        
        return "%s.%s_%s" % (self.app_name.lower(), self.model_name.lower(), action)
926005
def allow_rwe(self, name):
        """"""
        assert name in PERMISSIONS.keys()
        os.chmod(self.file_path, PERMISSIONS[name]['all'])
452319
def can_edit(self, user):
        """"""
        return user.is_admin or not self.is_locked and self in user.admin_for
909870
def is_editable(self, request):
        
        return request.user.is_superuser or request.user.id == self.user_id
245444
def crud_permission_name(model, action, convert=True):
    
    app_label = model._meta.app_label
    model_lower = model.__name__.lower()
    if convert:
        action = MAP_PERMISSION_ACTIONS.get(action, action)
    return '%s.%s_%s' % (
        app_label,
        action,
        model_lower
    )
1232966
public boolean hasPermission(final ApiKey apiKey, String permissionName) {
        if (apiKey.getTeams() == null) {
            return false;
        }
        for (final Team team: apiKey.getTeams()) {
            final List<Permission> teamPermissions = getObjectById(Team.class, team.getId()).getPermissions();
            for (final Permission permission: teamPermissions) {
                if (permission.getName().equals(permissionName)) {
                    return true;
                }
            }
        }
        return false;
    }
833994
def update(self, permission):
        """"""
        self.needs.update(permission.needs)
        self.excludes.update(permission.excludes)