Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity trello integration #1

Open
0mongoose opened this issue Feb 9, 2016 · 10 comments
Open

Activity trello integration #1

0mongoose opened this issue Feb 9, 2016 · 10 comments

Comments

@0mongoose
Copy link
Collaborator

We've already added trello integration for projects, by making each project create a board, and a webhook to change the project based on changes to the board. We'd like each activity to create a card and checklist, and keep references to them, as well as creating a webhook to change the status of the card based on the list it is in.
The breakdown is:

  1. Generate migrations to add card and checklist to the Activity model. These will be strings used to save the Trello ids of the corresponding checklist
  2. Generate a migration to add status to the Activity model. Where statuses are the same as the list names at Trello [To Do, Doing, Done], Or any customized lists set at Trello Board.

To learn more about migration check the railsdocs link: http://edgeguides.rubyonrails.org/active_record_migrations.html

  1. Add a function to the the Activity model to create a card (named like the activity) and a checklist (called to do, for example) with every new instance of Activity, and save their ids in the card and board attributes of Activity model.

hint: use anafter_create callback

  1. Add a Trello Webhook to update an activity status every time a card moved from list to the other.

We've already created a branch called trello_integration which includes tests to help guide the process and ensure that the results are as expected. To run them, run rspec spec/models/activity_spec.rb. Make sure all your work is done in this branch.

P.S: The trello member token and trello developer key are saved as environment variables in a file in the /config/initializers/app_env_vars.rb . There's is an example one in /config/initializers/app_env_vars_example.rb , which you should rename and add your own keys to. Note that is part of the .gitignore file for security reasons. You will also need to change the /config/initializers/setup_mailer.rb file if you want to use mail functionality.

@mohamedabbasos
Copy link

@0mongoose , I can't find the trello config file in this path /config/initializers/app_env_vars.rb , also in this path /config/initializers/app_env_vars_example.rb

@arwaahmed
Copy link
Collaborator

arwaahmed commented May 5, 2016

@mohamedabbasos you need first to checkout to trello_integration branch instead of working on master and in this branch you will find the file.

@mohamedabbasos
Copy link

@arwaahmed thanks.

@arwaahmed
Copy link
Collaborator

app_env_vars.rb should be created by you with app_env_vars_example.rb as a reference. It won't be pushed to the repo, since it is include in the .gitignore file.

@mohamedabbasos
Copy link

@arwaahmed i got it , thanks

i pull the branch and create the file app_env_vars.rb update it with

  • demo data configurations
    ENV['MAILER_ACCOUNT'] = "alias@example.com" ENV['MAILER_ACCOUNT_PASSWORD'] = "12345678"
  • my trello configurations the Key and the OAuth Secret as the same as the app_env_vars_example.rb file

The app opened successfully in the browser , i logged in with the demo data but when i trying to add a new project in the pathprojects/new i get that error

CanCan::AccessDenied in ActivitiesController#new You are not authorized to access this page.

the same error appears when i try to add new activity or list members or donors .. etc

i know that my questions are about configurations not a bout this issue , but i don't know where to put them

@arwaahmed
Copy link
Collaborator

@mohamedabbasos The cause of the error is that the current user is assigned to the role Guest which has limited access.
First you need to pull the latest changes (changes related to seed.rb). Then go ahead and seed the database (It is better if you reset db first). A user with an role of an admin would be created and with it you can access everything.

As for configuration (though not related to the error you mentioned) it seems where you put them is fine as long as you used a valid email credentials in the /config/initializers/app_env_vars.rb and changed the /config/initializers/setup_mailer.rb accordingly

@mohamedabbasos
Copy link

mohamedabbasos commented May 7, 2016

@arwaahmed

First you need to pull the latest changes

I was cloned a few days ago (about two days), and the last commit to the project before that
also i check the db/seeds.rb
and i found this line
User.create(name: 'admin', full_name: 'Administrator', email: 'alias@example.com', password: '12345678', password_confirmation: '12345678', active: true, confirmed_at: Time.now, role_id: role2.id)
i think that is mean the user with the email : 'alias@example.com have an admin permissions
check this https://github.com/Eptikar-IT-Solutions/openngo/blob/master/db/seeds.rb#L13

and for this /config/initializers/setup_mailer.rb
Can i use Eptikar mail account ? as demo or I should use my private email

@arwaahmed
Copy link
Collaborator

arwaahmed commented May 7, 2016

@mohamedabbasos
There were some more recent changes was pushed to solve a bug on the seed. You should pull and then clear the database preferably and then reseed the database.

Or as an alternative you can make sure that the role admin has permissions {all: true} and then set role_id for your user to the id of that role.

As for smtp settings you need to use your own private account.

@mohamedabbasos
Copy link

mohamedabbasos commented May 7, 2016

@arwaahmed
This code form my local files:
role2 = Role.create(name: 'Admin', permissions:{all: true})
User.create(name: 'admin', full_name: 'Administrator', email: 'alias@example.com', password: '12345678', password_confirmation: '12345678', active: true, confirmed_at: Time.now, role_id: role2.id)

And this mean its updated :/

Because its congruous with your words and with the code here:
https://github.com/Eptikar-IT-Solutions/openngo/blob/master/db/seeds.rb#L11

As for smtp settings you need to use your own private account.

OK , But i don't know tell now whats the importance of this part ? and is it related to the issue ?
can i escape it ?

@arwaahmed
Copy link
Collaborator

arwaahmed commented May 7, 2016

@mohamedabbasos As for SMTP settings, it is not really related to the issue . It is needed when creating a new user. To escape it set confirmed_at to Time.now(for instance), and no confirmation email would be sent. This is as the creation of user in seed file:
User.create(name: 'admin', full_name: 'Administrator', email: 'alias@example.com', password: '12345678', password_confirmation: '12345678', active: true, confirmed_at: Time.now , role_id: role2.id)

As for the role issue the lines of code you mentioned earlier is not up to date. Please pull first. You can either reseed database after clearing users and roles tables and it will work fine.

Or you can copy the the lines of code in seed to the rails console, whatever work for you that will achieve the result of a user has the role with permissions: {all: true}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants