(
            self, user_list=None, group_list=None,
            make_public=False, permissions=None)
return error.check_return_status(response, logger)
Add users or groups to the sketch ACL.

        Args:
            user_list: optional list of users to add to the ACL
                of the sketch. Each user is a string.
            group_list: optional list of groups to add to the ACL
                of the sketch. Each user is a string.
            make_public: Optional boolean indicating the sketch should be
                marked as public.
            permissions: optional list of permissions (read, write, delete).
                If not the default set of permissions are applied (read, write)

        Returns:
            A boolean indicating whether the ACL change was successful.
Add users or groups to the sketch ACL.
Add users or groups to the sketch ACL .
def add_to_acl(
            self, user_list=None, group_list=None,
            make_public=False, permissions=None):
        """Add users or groups to the sketch ACL.

        Args:
            user_list: optional list of users to add to the ACL
                of the sketch. Each user is a string.
            group_list: optional list of groups to add to the ACL
                of the sketch. Each user is a string.
            make_public: Optional boolean indicating the sketch should be
                marked as public.
            permissions: optional list of permissions (read, write, delete).
                If not the default set of permissions are applied (read, write)

        Returns:
            A boolean indicating whether the ACL change was successful.
        """
        if not user_list and not group_list and not make_public:
            return False

        resource_url = '{0:s}/sketches/{1:d}/collaborators/'.format(
            self.api.api_root, self.id)

        data = {}
        if group_list:
            group_list_corrected = [str(x).strip() for x in group_list]
            data['groups'] = group_list_corrected

        if user_list:
            user_list_corrected = [str(x).strip() for x in user_list]
            data['users'] = user_list_corrected

        if make_public:
            data['public'] = 'true'

        if permissions:
            allowed_permissions = set(['read', 'write', 'delete'])
            use_permissions = list(
                allowed_permissions.intersection(set(permissions)))
            if set(use_permissions) != set(permissions):
                logger.warning('Some permissions are invalid: {0:s}'.format(
                    ', '.join(list(
                        set(permissions).difference(set(use_permissions))))))

            if not use_permissions:
                logger.error('No permissions left to add.')
                return False

            data['permissions'] = json.dumps(use_permissions)

        if not data:
            return True

        response = self.api.session.post(resource_url, json=data)
        # Refresh the sketch data to reflect ACL changes.
        _ = self.lazyload_data(refresh_cache=True)
        return error.check_return_status(response, logger)
def add_to_acl ( self , user_list = None , group_list = None , make_public = False , permissions = None ) : if not user_list and not group_list and not make_public : return False resource_url = '{0:s}/sketches/{1:d}/collaborators/' . format ( self . api . api_root , self . id ) data = { } if group_list : group_list_corrected = [ str ( x ) . strip ( ) for x in group_list ] data [ 'groups' ] = group_list_corrected if user_list : user_list_corrected = [ str ( x ) . strip ( ) for x in user_list ] data [ 'users' ] = user_list_corrected if make_public : data [ 'public' ] = 'true' if permissions : allowed_permissions = set ( [ 'read' , 'write' , 'delete' ] ) use_permissions = list ( allowed_permissions . intersection ( set ( permissions ) ) ) if set ( use_permissions ) != set ( permissions ) : logger . warning ( 'Some permissions are invalid: {0:s}' . format ( ', ' . join ( list ( set ( permissions ) . difference ( set ( use_permissions ) ) ) ) ) ) if not use_permissions : logger . error ( 'No permissions left to add.' ) return False data [ 'permissions' ] = json . dumps ( use_permissions ) if not data : return True response = self . api . session . post ( resource_url , json = data ) # Refresh the sketch data to reflect ACL changes. _ = self . lazyload_data ( refresh_cache = True ) return error . check_return_status ( response , logger )