Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
cea34571
Commit
cea34571
authored
May 30, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #111
parent
2674efa4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
14 deletions
+45
-14
.eslintrc
.eslintrc
+5
-5
path.json
path.json
+1
-1
sidebar_menu.jsx
src/components/sidebar_menu.jsx
+14
-4
user_store.jsx
src/stores/user_store.jsx
+6
-0
client.jsx
src/utils/client.jsx
+19
-4
No files found.
.eslintrc
View file @
cea34571
...
...
@@ -60,7 +60,7 @@
"block-scoped-var": 2,
"complexity": [0, 8],
"consistent-return": 2,
#
"consistent-return": 2,
"curly": [2, "all"],
"dot-location": [2, "object"],
"dot-notation": 2,
...
...
@@ -71,7 +71,7 @@
"no-array-constructor": 2,
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 2,
#
"no-else-return": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
...
...
@@ -112,7 +112,7 @@
"yoda": [2, "never", {"exceptRange": false, "onlyEquality": false}],
"no-undefined": 2,
"no-shadow": [2, {"hoist": "functions"}],
#
"no-shadow": [2, {"hoist": "functions"}],
"no-shadow-restricted-names": 2,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-use-before-define": [2, "nofunc"],
...
...
@@ -142,9 +142,9 @@
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": [2, { "skipBlankLines": false }],
"no-underscore-dangle": 2,
#
"no-underscore-dangle": 2,
"no-unneeded-ternary": [2, {"defaultAssignment": false}],
"object-curly-spacing": [2, "never"],
#
"object-curly-spacing": [2, "never"],
"one-var": [2, "never"],
"operator-linebreak": [2, "after"],
"padded-blocks": [2, "never"],
...
...
path.json
View file @
cea34571
module.exports
=
{
"main"
:{
"js"
:
"/080240bundle.js"
}}
\ No newline at end of file
module.exports
=
{
"main"
:{
"js"
:
"/619769bundle.js"
}}
\ No newline at end of file
src/components/sidebar_menu.jsx
View file @
cea34571
...
...
@@ -19,9 +19,19 @@ export default class SidebarMenu extends React.Component {
browserHistory
.
push
(
path
);
}
}
render
()
{
const
companyText
=
UserStore
.
isGlobalAdmin
()
?
'Empresas'
:
'Mi Empresa'
;
makeCompanyLink
()
{
const
link
=
{
text
:
'Empresas'
,
path
:
'/companies'
};
if
(
!
UserStore
.
isGlobalAdmin
())
{
const
user
=
UserStore
.
getCurrentUser
();
link
.
text
=
'Mi Empresa'
;
link
.
path
=
`/companies/
${
user
.
company_id
}
`
;
}
return
link
;
}
render
()
{
const
companyLink
=
this
.
makeCompanyLink
();
return
(
<
ul
className=
'nav'
...
...
@@ -30,9 +40,9 @@ export default class SidebarMenu extends React.Component {
<
li
id=
'sidebar-companies'
>
<
a
href=
'#'
onClick=
{
(
e
)
=>
this
.
handleLink
(
e
,
'/companies'
)
}
onClick=
{
(
e
)
=>
this
.
handleLink
(
e
,
companyLink
.
path
)
}
>
<
span
className=
'nav-label'
>
{
company
T
ext
}
</
span
>
<
span
className=
'nav-label'
>
{
company
Link
.
t
ext
}
</
span
>
</
a
>
</
li
>
<
li
id=
'sidebar-domains'
>
...
...
src/stores/user_store.jsx
View file @
cea34571
...
...
@@ -36,6 +36,12 @@ class UserStoreClass extends EventEmitter {
return
null
;
}
getPrimaryDomain
()
{
const
user
=
this
.
getCurrentUser
();
const
domain
=
user
?
user
.
name
.
split
(
/@/
)[
1
]
:
null
;
return
domain
;
}
isGlobalAdmin
()
{
const
user
=
this
.
getCurrentUser
();
...
...
src/utils/client.jsx
View file @
cea34571
...
...
@@ -90,10 +90,25 @@ export function getMe(success, error) {
const
e
=
handleError
(
'getMe'
,
err
);
return
error
(
e
);
}
Reflect
.
deleteProperty
(
data
,
'obj'
);
GlobalActions
.
saveUser
(
data
);
return
success
();
const
user
=
data
;
if
(
user
.
attrs
.
_attrs
.
zimbraIsAdminAccount
===
'TRUE'
)
{
Reflect
.
deleteProperty
(
user
,
'obj'
);
GlobalActions
.
saveUser
(
user
);
return
success
();
}
else
{
const
domain
=
user
.
name
.
split
(
/@/
)[
1
];
zimbra
.
getDomain
(
domain
,
(
e
,
d
)
=>
{
if
(
e
)
{
const
error
=
handleError
(
'getDomain'
,
e
);
return
error
(
error
);
}
user
.
company_id
=
d
.
attrs
.
businessCategory
;
Reflect
.
deleteProperty
(
user
,
'obj'
);
GlobalActions
.
saveUser
(
user
);
return
success
();
});
}
});
},
(
err
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment