# An easier way to extract role as an uncluttered string

**URL:** <https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 1, 2024, 8:42pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120 "2024-02-01T20:42:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [February 1, 2024, 8:42pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120/1 "2024-02-01T20:42:54Z")

</div>

i just want a bloody string.

```python
userRoles = []
for role in self.session.props.auth.user.roles:
	userRoles.append(str(role))
message = str(value) + ' -> ' + str(userRoles)
return message #<-- yields: Ian -> ['Read/Write', 'canEdit']
                # i want JUST: Ian -> Read/Write, canEdit

```

i seem to recall there is a simpler way to do this with some Java call, but i'm not a Java dude (yet). tired of having to do these dopey convolutions just to get a clean result. halp!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 1, 2024, 8:50pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120/2 "2024-02-01T20:50:33Z")

</div>

Why not use python's `.join()` method?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 1, 2024, 8:52pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120/3 "2024-02-01T20:52:49Z")

</div>

If you don't want a list then don't create a list???

```auto
return "{} -> {}".format(value, ','.join(self.session.props.auth.user.roles)

```

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [February 1, 2024, 9:04pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120/4 "2024-02-01T21:04:07Z")

</div>

i thought there was a simpler way using some `system.user.doSomeThing()`. i already have used `join()` to clean it up. i must have just misremembered. thx guys. i'll delete this. no real use.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 1, 2024, 9:04pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120/5 "2024-02-01T21:04:58Z")

</div>

> [@ian.sebryk](#):
>
> i'll delete this. no real use.

Sure there is, some other user will come and find it, and will have their question answered before they ask it.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [February 1, 2024, 9:10pm UTC](https://forum.inductiveautomation.com/t/an-easier-way-to-extract-role-as-an-uncluttered-string/85120/6 "2024-02-01T21:10:57Z")

</div>

fair enough.
