Skip to content

ERP Apps - CRM Cloud Angular 11 and Google FireStore database, Role based security

Notifications You must be signed in to change notification settings

AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase

Repository files navigation

- If you like this project, please consider giving it a star (*) and follow me at GitHub & YouTube.

ERP-Apps

Objective

Build ERP apps for Small, Medium and Large Organizations
Re-Write / Build new CRM GUI App for existing ERP
Convert Old Software to new App/UI (Desktop & Mobile) without changing database
Migrate existing ERP to new platform
Make an App for existing Oracle, PeopleSoft, SAP, or Siebel CRM or old custom software based ERP

Community Version - All apps are Free download with complete source code for iOS, Android and web.
Click here for Video Tutorials !

Installation Instructions
Step 1: Install your favorite Code editor
Anroid Studio, IntelliJ community edition, Visual Studio Code

Step 2: download node js
make sure, your windows, linux or mac environment path is setup to the directory where your node.exe file is
for example

Path  = c:\amit.la\Program\node
now run following commands in terminal window
$ node -v
$ npm -v
make sure both the these commands return a valid node and npm version.
now install angular cli
$ npm install -g @angular/cli
// after installation
$ ng version
make sure ng version returns a valid Angular cli version.

Step 3: download this GitHub repository - Fork/Download Zip 
extract all files to your c drive and browse to the directory where you can see package.json
$ npm install --save
make sure installation finished without any error
$ ng serve --open
at this point, your app will serve on localhost:4200 but it show some errors because your firebase in not setup yet

Step 4: Setup Firebase project 
go to -> console.firebase.com
set up a new project
inside your project, click on authentication and enable
email/password, Google and Facebook authentication methods
now setup Firebase rules
please copy paste these rules as-is and make sure, there are no errors anywhere.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
  allow read, write: if false;
}

match /USER_ROLES/{document} {
allow read: if isSignedIn();
}
match /USER_SETTINGS/{document} {
allow read: if (isSignedIn() && isDocOwner()) || isAdmin();
allow create: if isSignedIn() && onlyContentChanged();
allow update: if (isSignedIn() && isDocOwner() && onlyContentChanged()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_ADDRESSBOOK/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_CAMPAIGN/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_LEADS/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_OPPURTUNITY/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_APPOINTMENTS/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_CALLS/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_TICKETS/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_WORKORDERS/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
match /USER_ORDERS/{document=**} {
allow read: if (isSignedIn() && isEmployee()) || isAdmin();
allow create: if isSignedIn();
allow update: if (isSignedIn() && isDocOwner()) || isAdmin();
allow delete: if isAdmin();
}
// helper functions
function isSignedIn() {
return request.auth.uid != null;
}
function onlyContentChanged() {
return request.resource.data.role == "" || request.resource.data.role == resource.data.role;
// make sure user is not signing in with any role or changin his role during update
}
function isDocOwner() {
return request.auth.uid == resource.data.author;
}
function isDocCreater() {
return request.auth.uid == request.resource.data.author;
}
function isAdmin() {
return get(/databases/$(database)/documents/USER_SETTINGS/$(request.auth.uid)).data.role == "admin";
}
function isEmployee() {
return get(/databases/$(database)/documents/USER_SETTINGS/$(request.auth.uid)).data.role == "employee";
}
}
}
Step 5: Create new data collection
as shown in this screen and make sure all documents/fields look exactly the same.

YouTube video Part -1 @ 13:08

USER_ROLES is a collection
admin is a document inside it
admin, addressbook etc each has a “map” inside
Which has four fields each
visible Boolean true
read Boolean true
write Boolean true
delete Boolean true

Step 6: find Firebase Project settings
copy and replace Firebase settings in your app->environments/environment.ts and environment.prod.ts


Step 7: Browse App 
to check if your app is up and running now if not, please open browser console and look for errors

if firebase is not setup properly or settings are not copies correctly, you will see error like invalid API Key.

For any other error please open a new issue and include a screen shot of your terminal and browser console window.

Pro Version Enquiries [email protected] - ERP

Other Apps -> CRM Cloud
Marketting
Helpdesk
BPO/Call Register
Customer Order Fullfillment

Supply Chain
Buy To Pay
Customer Order Fullfillment
Sales
Live Inventory

Finance
Book Keeping
Accounts Payable
Accounts Receivable
Expense Management
Assets management

HCM Employee Management App
Supply Chain App
Inventory Management App
Book Keeping App
Buy to Pay B2P App
Accounts Payables App
Accounts Receivables App
Vendor Management App
Help Desk App
Call Center App
Order Fullfillment App
Product Catalogue
Order Fullfillment App
Expense Management
Assets management
Warehouse Management App

Requisition -> Generate Req and auto PO
PO -> Request Inventory
Receipt -> Receive Inventory
Payables -> Setup Vendor
-> Voucher for Vendor
-> Pay Vendor
Receivables-> Setup Customer
-> Invoice for Customer
-> Receive
Sales Register

Reports

Inventory Cycle Count
Inventory Snapshot
report - On Hand Inventory
Payables -> Setup Vendor
-> Voucher for Vendor
-> Pay Vendor

About

ERP Apps - CRM Cloud Angular 11 and Google FireStore database, Role based security

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages