Skip to content

Commit 21e16ac

Browse files
author
vikasrohit
authored
Merge pull request #3969 from appirio-tech/dev
Prod Release: 2.9.0
2 parents 37ac8f1 + 65bdd7a commit 21e16ac

File tree

83 files changed

+3754
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3754
-796
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ workflows:
136136
- build-dev
137137
filters:
138138
branches:
139-
only: ['v5-upgrade', 'feature/new-project-catalog']
139+
only: ['feature/permissions']
140140

141141
- deployProd:
142142
context : org-global

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Topcoder Connect App
22

33
Topcoder Connect is client facing application of Topcoder. Customers use Topcoder Connect to input requirements of their projects, then managers and
4-
copilots take it from there.
4+
copilots take it from there.
55

66
## Requirements
77

@@ -25,6 +25,8 @@ Open browser with URL http://local.topcoder-dev.com:3000.
2525
- `$ npm run lint:fix` - Check js code linting and trying to fix errors automatically.
2626
- `$ npm run test` - Performs tests running. **Note** we don't really have tests, so we only keep this command run successfully.
2727
- `$ npm run test:watch` - Performs tests on files changes.
28+
- `$ generate:doc:permissions` - Generate [Permissions documentation](./docs/permissions.html) from the constants
29+
- `$ generate:doc:permissions:dev` - same like above, but it regenerates the document on every file change and is handy during development
2830

2931
## TC Deployment Notes
3032
_[TC Deployment Notes should always be kept up to date **on the default branch**. Update these notes when changes to this information occur]_
@@ -97,6 +99,7 @@ SCSS Files
9799
}
98100
}
99101
}
102+
100103
SVG Icons
101104
- This repository uses plugin babel-plugin-inline-react-svg
102105
- The plugin is used to inline-embed svg icons inside the markup
181 KB
Loading
245 KB
Loading
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Permissions Guide
2+
3+
## References
4+
5+
- [Permissions list](https://htmlpreview.github.io/?https://github.com/appirio-tech/connect-app/blob/dev/docs/permissions.html)
6+
7+
- [Permissions list source](https://github.com/appirio-tech/connect-app/blob/dev/src/config/permissions.js)
8+
9+
## How to Use
10+
11+
Let's say you would like to add a new place in code where you want to check user roles/permissions. Please, follow the next guide:
12+
13+
1. Check if we already have defined permission for your case in the [permissions list](https://htmlpreview.github.io/?https://github.com/appirio-tech/connect-app/blob/dev/docs/permissions.html).
14+
15+
2. If you cannot find the permission you need, add new permission to the file https://github.com/appirio-tech/connect-app/blob/dev/src/config/permissions.js.
16+
17+
1. Follow the guides on how to add a new permission in the header of this file.
18+
19+
2. After you add a new permission, regenerate [permissions list](https://htmlpreview.github.io/?https://github.com/appirio-tech/connect-app/blob/dev/docs/permissions.html) by running `npm run generate:doc:permissions`.
20+
21+
3. To check if user has permission in code use method `hasPermission(permission)`.
22+
23+
Example:<br>
24+
25+
```js
26+
import PERMISSIONS from 'config/permissions'
27+
import { hasPermission } from 'helpers/permissions'
28+
29+
if (hasPermission(PERMISSIONS.MANAGE_PROJECT_PLAN)) {
30+
...
31+
}
32+
```
33+
34+
- Note, optionally, you may pass the `project` object like this `hasPermission(permission, project)`. But you don't have to as `hasPermission` gets `project` object from the Redux Store (`projectState.project`) automatically. Only in case if you want to check user permission to another project which is not loaded into the Redux Store then you may pass `project` explicitly.
35+
36+
## Roles
37+
38+
Every user may have 2 kind of roles: **Topcoder Roles** and **Project Role**.
39+
40+
### Topcoder Roles
41+
42+
These roles are assigned to user accounts. User may have several **Topcoder Roles**. See [the list of all Topcoder Roles](https://github.com/appirio-tech/connect-app/blob/dev/src/config/constants.js#L656-L668) which we use in Connect App.
43+
44+
<img src="./images/topcoder-roles.png" width="819">
45+
46+
By default every user has one role `Topcoder User`, generally this means that such a user is either **customer** or **community member** (freelancer).
47+
48+
### Project Role
49+
50+
When user joins some project and become a member of the project, such a user has one **Project Role** inside that project. One user may have different **Project Role** in different projects. See [the list of all Project Roles](https://github.com/appirio-tech/connect-app/blob/dev/src/config/constants.js#L638-L647) which we use in Connect App.
51+
52+
<img src="./images/project-roles.png" width="720">

docs/permissions.html

Lines changed: 345 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)