Classic record share perms → structured data + compact text. Only direct user shares are listed. Shared-folder inheritance is omitted: the tree already places the record under its parent shared folder(s).
(params, record_uid, *, include_uids=False)
| 2193 | |
| 2194 | |
| 2195 | def _classic_record_share_data(params, record_uid, *, include_uids=False): |
| 2196 | """Classic record share perms → structured data + compact text. |
| 2197 | |
| 2198 | Only direct user shares are listed. Shared-folder inheritance is omitted: |
| 2199 | the tree already places the record under its parent shared folder(s). |
| 2200 | """ |
| 2201 | rec = (params.record_cache or {}).get(record_uid) or {} |
| 2202 | shares_data = rec.get('shares') or {} |
| 2203 | users = [] |
| 2204 | user_parts = [] |
| 2205 | for up in shares_data.get('user_permissions') or []: |
| 2206 | email = up.get('username') or '' |
| 2207 | if not email: |
| 2208 | continue |
| 2209 | if up.get('owner'): |
| 2210 | users.append({'email': email, 'permissions': ['OW']}) |
| 2211 | user_parts.append(f'[{email}:OW]') |
| 2212 | continue |
| 2213 | if email == params.user: |
| 2214 | continue |
| 2215 | privs = [] |
| 2216 | if up.get('editable'): |
| 2217 | privs.append('CE') |
| 2218 | if up.get('shareable'): |
| 2219 | privs.append('CS') |
| 2220 | if not privs: |
| 2221 | privs = ['RO'] |
| 2222 | users.append({'email': email, 'permissions': privs}) |
| 2223 | user_parts.append(f'[{email}:{",".join(privs)}]') |
| 2224 | if not users: |
| 2225 | return None, '' |
| 2226 | data = {'users': users} |
| 2227 | text = f' (users:{",".join(user_parts)})' |
| 2228 | return data, text |
| 2229 | |
| 2230 | |
| 2231 | def _nsf_record_share_data(params, record_uid, *, include_uids=False): |